My car is now complete. Warp engine installed and dilithium crystals are fully crystallised and ready for anti-matter reaction. Plasma injection systems powering the stereo with some phat C64 remixes playing... Ready for Warp 9 (but alas, in Evesham I'll be lucky to reach 15mph).
Engage.
Sunday, April 28, 2019
Wednesday, April 10, 2019
Technical Post - Creating new Active Directory user accounts on Windows Server 2016 using Powerscript
A useful little Powerscript which I have written for student user creation in a Windows Active Directory. Some features may not be useful to all since I wrote this for our needs in our school, but it's pretty straight forward to use and I'm sure it could easily be modified to fit someones needs if they wanted the same. The script creates the user object in Active Directory, adds them to groups, creates their user folder (on a different server), and sets the correct permissions on that folder.
I've posted this here more of a reminder to me if I ever need to revisit it, and I'm sure there is probably a far better and efficient way of doing this, but it may help someone, somewhere!
A couple of things to bear in mind.. Our student username format begins with two digits, then the first three letters of their surname, and then the first three letters of their forename (ie 19WilStu). AND obviously, any references to server names and folder locations will need to be updated with your details
Please feel free to comment, and let me know if you have a better way of doing it :D
Write-Host ""
Write-Host " STUDENT USER CREATION SCRIPT (Powerscript V1)"
Write-Host " ---------------------------------------------"
Write-Host " By Stu - 09/04/2019"
Write-Host ""
# ---------------------------------------------------------------------
# - LETS GET SOME VARIABLES AND CREATE THE USERNAME FORMAT -
# ---------------------------------------------------------------------
#
$forename = read-host -prompt 'Input users forename'
$surname = read-host -prompt 'Input users Surname'
$year = read-host -prompt 'Input users year - (This is the number in their username eg. 15, 06, 03)'
$forename_Three = ($forename.SubString(0,3))
$Surname_Three = ($surname.SubString(0,3))
$username = $Year + $Surname_Three + $Forename_Three
Write-Host "Hello $username"
# ---------------------------------------------------------------------
# - CHECK TO SEE IF USER EXISTS OR NOT -
# ---------------------------------------------------------------------
#
if (dsquery user -samid $username)
{
Write-Host "Found user - PLEASE RESTART AND START AGAIN"
Pause
exit
}
else {"Did not find user - Let's continue to setup the user"}
$password = read-host -prompt 'Enter default password'
Write-Host ""
Write-Host " We have everything we need to create the user account. Please wait"
Write-Host ""
# ---------------------------------------------------------------------
# - CREATE USER OBJECT IN ACTIVE DIRECTORY -
# ---------------------------------------------------------------------
#
New-ADUser $username -AccountPassword (ConvertTo-SecureString -AsPlainText $password -Force) -ChangePasswordAtLogon $True -path "OU=Year$Year,OU=Pupils,OU=Domain Users,DC=yourdomain,DC=local" -Company "Year$Year" -DisplayName "$forename $surname" -Description "Initial Password is $password" -HomeDrive U -HomeDirectory "\\Yourfileserver\folder\students\userareas\Year$Year\$username" -HomePage "www.yourwebsite.com" -UserPrincipalName "$username@domain" -EmailAddress "$username@youremaildomain.com" -Enabled $True -SamAccountName $username -Surname $Surname -GivenName $Forename -ea Stop
Add-ADGroupMember -Identity "Pupils" -Members $username
Add-ADGroupMember -Identity Year"$Year"Group -Members $username
# ---------------------------------------------------------------------
# - USER AREA FOLDER CREATION AND PERMISSIONS -
# ---------------------------------------------------------------------
#
$samAccountName = $username
$fullPath = "\\Yourfileserver\folder\students\userareas\Year$Year\{0}" -f $samAccountName
$driveLetter = "U:"
$User = Get-ADUser -Identity $samAccountName
if($User -ne $Null) {
Set-ADUser $User -HomeDrive $driveLetter -HomeDirectory $fullPath -ea Stop
$homeShare = New-Item -path $fullPath -ItemType Directory -force -ea Stop
$acl = Get-Acl $homeShare
$FileSystemRights = [System.Security.AccessControl.FileSystemRights]"Modify"
$AccessControlType = [System.Security.AccessControl.AccessControlType]::Allow
$InheritanceFlags = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"
$PropagationFlags = [System.Security.AccessControl.PropagationFlags]"InheritOnly"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($samAccountName, $FileSystemRights, $InheritanceFlags, $PropagationFlags, $AccessControlType)
$acl.AddAccessRule($AccessRule)
Set-Acl -Path $homeShare -AclObject $acl -ea Stop
Write-Host ("HomeDirectory created at {0}" -f $fullPath)
}
# ---------------------------------------------------------------------
# -This bit creates the default subject folders in the users user area- -
# ---------------------------------------------------------------------
#
new-item \\Yourfileserver\folder\students\userareas\Year$Year\$username\Art -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Business -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Design -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Drama -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\English -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Food -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Geography -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\History -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\ICT -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Languages -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Maths -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Music -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\PE -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Personal -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\RE -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Science -itemtype directory
Clear-Host
Write-Host ""
Write-Host "User $username has now been created successfully"
Write-Host ""
Write-Host "Username : $username"
Write-Host "Password : $password"
Write-Host ""
Pause
I've posted this here more of a reminder to me if I ever need to revisit it, and I'm sure there is probably a far better and efficient way of doing this, but it may help someone, somewhere!
A couple of things to bear in mind.. Our student username format begins with two digits, then the first three letters of their surname, and then the first three letters of their forename (ie 19WilStu). AND obviously, any references to server names and folder locations will need to be updated with your details
Please feel free to comment, and let me know if you have a better way of doing it :D
Write-Host ""
Write-Host " STUDENT USER CREATION SCRIPT (Powerscript V1)"
Write-Host " ---------------------------------------------"
Write-Host " By Stu - 09/04/2019"
Write-Host ""
# ---------------------------------------------------------------------
# - LETS GET SOME VARIABLES AND CREATE THE USERNAME FORMAT -
# ---------------------------------------------------------------------
#
$forename = read-host -prompt 'Input users forename'
$surname = read-host -prompt 'Input users Surname'
$year = read-host -prompt 'Input users year - (This is the number in their username eg. 15, 06, 03)'
$forename_Three = ($forename.SubString(0,3))
$Surname_Three = ($surname.SubString(0,3))
$username = $Year + $Surname_Three + $Forename_Three
Write-Host "Hello $username"
# ---------------------------------------------------------------------
# - CHECK TO SEE IF USER EXISTS OR NOT -
# ---------------------------------------------------------------------
#
if (dsquery user -samid $username)
{
Write-Host "Found user - PLEASE RESTART AND START AGAIN"
Pause
exit
}
else {"Did not find user - Let's continue to setup the user"}
$password = read-host -prompt 'Enter default password'
Write-Host ""
Write-Host " We have everything we need to create the user account. Please wait"
Write-Host ""
# ---------------------------------------------------------------------
# - CREATE USER OBJECT IN ACTIVE DIRECTORY -
# ---------------------------------------------------------------------
#
New-ADUser $username -AccountPassword (ConvertTo-SecureString -AsPlainText $password -Force) -ChangePasswordAtLogon $True -path "OU=Year$Year,OU=Pupils,OU=Domain Users,DC=yourdomain,DC=local" -Company "Year$Year" -DisplayName "$forename $surname" -Description "Initial Password is $password" -HomeDrive U -HomeDirectory "\\Yourfileserver\folder\students\userareas\Year$Year\$username" -HomePage "www.yourwebsite.com" -UserPrincipalName "$username@domain" -EmailAddress "$username@youremaildomain.com" -Enabled $True -SamAccountName $username -Surname $Surname -GivenName $Forename -ea Stop
Add-ADGroupMember -Identity "Pupils" -Members $username
Add-ADGroupMember -Identity Year"$Year"Group -Members $username
# ---------------------------------------------------------------------
# - USER AREA FOLDER CREATION AND PERMISSIONS -
# ---------------------------------------------------------------------
#
$samAccountName = $username
$fullPath = "\\Yourfileserver\folder\students\userareas\Year$Year\{0}" -f $samAccountName
$driveLetter = "U:"
$User = Get-ADUser -Identity $samAccountName
if($User -ne $Null) {
Set-ADUser $User -HomeDrive $driveLetter -HomeDirectory $fullPath -ea Stop
$homeShare = New-Item -path $fullPath -ItemType Directory -force -ea Stop
$acl = Get-Acl $homeShare
$FileSystemRights = [System.Security.AccessControl.FileSystemRights]"Modify"
$AccessControlType = [System.Security.AccessControl.AccessControlType]::Allow
$InheritanceFlags = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"
$PropagationFlags = [System.Security.AccessControl.PropagationFlags]"InheritOnly"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($samAccountName, $FileSystemRights, $InheritanceFlags, $PropagationFlags, $AccessControlType)
$acl.AddAccessRule($AccessRule)
Set-Acl -Path $homeShare -AclObject $acl -ea Stop
Write-Host ("HomeDirectory created at {0}" -f $fullPath)
}
# ---------------------------------------------------------------------
# -This bit creates the default subject folders in the users user area- -
# ---------------------------------------------------------------------
#
new-item \\Yourfileserver\folder\students\userareas\Year$Year\$username\Art -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Business -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Design -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Drama -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\English -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Food -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Geography -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\History -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\ICT -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Languages -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Maths -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Music -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\PE -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Personal -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\RE -itemtype directory
new-item \\Yourfileserver\folder\students\userareas\Year$Year\Science -itemtype directory
Clear-Host
Write-Host ""
Write-Host "User $username has now been created successfully"
Write-Host ""
Write-Host "Username : $username"
Write-Host "Password : $password"
Write-Host ""
Pause
Sunday, April 07, 2019
Game Covers - Big Mac The Mad Maintenance Man (Commodore 64)
Labels:
1.99,
1980s,
1985,
199,
8bit,
Big Mac,
C64,
Commodore 64,
computer games,
Gaming,
maintenance man,
mastertronic,
platform,
Retro,
Retrogaming
Tuesday, April 02, 2019
Game Covers - Street Beat (Commodore 64)
Click to enlarge
Click to enlarge
Click to enlarge
Labels:
1980s,
1987,
80s,
8bit,
boxart,
C64,
Commodore 64,
covers,
Gaming,
ghettoblaster,
mastertronic,
Retro,
Street Beat
Game Covers - Tom Thumb (Commodore 16 & Plus 4)
Original cover (Click to enlarge)
Cleaned cover (Click to enlarge)
Click to enlarge
Labels:
178 screens,
1986,
8bit,
anirog,
arcade adventure,
C16,
commodore,
Commodore 16,
Commodore Plus 4,
Gaming,
Manilo,
Plus 4,
Retro,
Tom,
Tom Thumb,
tomb,
Udo Gertz
Game Covers - Ghost Town (Commodore 16 & Plus 4)
Original cover (click to enlarge)
Cleaned cover (click to enlarge)
Click to enlarge
Labels:
1986,
80s,
8bit,
adventure,
anirog,
commodore,
Commodore 16,
Commodore Plus 4,
Gaming,
ghost town,
Plus 4,
Retro,
Udo Gertz
Subscribe to:
Posts (Atom)