From c217061a0f92283a545cfcbbd0a2af2d8c14c5ce Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Tue, 17 Dec 2019 10:26:44 -0500 Subject: [PATCH] Initial Commit, everything but computer name works --- ComputerList.csv | 2 + Set-ComputerName.ps1 | 29 +++++++ autounattend.xml | 181 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+) create mode 100755 ComputerList.csv create mode 100755 Set-ComputerName.ps1 create mode 100755 autounattend.xml diff --git a/ComputerList.csv b/ComputerList.csv new file mode 100755 index 0000000..e165018 --- /dev/null +++ b/ComputerList.csv @@ -0,0 +1,2 @@ +MAC,CN +78:45:c4:04:37:ab,TSMS-NINE-DTPC \ No newline at end of file diff --git a/Set-ComputerName.ps1 b/Set-ComputerName.ps1 new file mode 100755 index 0000000..9027e03 --- /dev/null +++ b/Set-ComputerName.ps1 @@ -0,0 +1,29 @@ +# Look up computer name from mac address in a file +# Based on Set-ComputerName from: +# https://kristopherjturner.com/2017/02/01/automating-computer-naming-after-deploying-windows-10-images/ + +$FileName = "ComputerList.csv" + +$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path + +$thisComputerMAC = Get-WmiObject win32_networkadapterconfiguration -Filter 'ipenabled = "true"' | Select-Object MACAddress +$ComputerList = Import-Csv -Path "$scriptPath\$FileName" + +# look up computer name by MAC address +ForEach ($Computer in $ComputerList) { + Write-Host "$($Computer.CN) $($Computer.MAC) $thisComputerMac" + If ($thisComputerMAC -match $Computer.MAC) { + Write-Host "$($Computer.CN) matches the localhost MAC Address: $thisComputerMAC" + $NewComputerName = $Computer.CN + } +} + +# if computer isn’t on list, ask for a name +If ($Null -eq $NewComputerName) { + Write-Host "Computer is not found in computer list." -ForegroundColor Red + $NewComputerName = Read-Host -Prompt "Please enter desired computer name then hit enter" +} + +# rename computer +Write-Host "Computer will be renamed to $NewComputerName." +Rename-Computer -NewName $NewComputerName -Force -Verbose \ No newline at end of file diff --git a/autounattend.xml b/autounattend.xml new file mode 100755 index 0000000..f06a0d9 --- /dev/null +++ b/autounattend.xml @@ -0,0 +1,181 @@ + + + + + + en-US + + 0409:00000409 + en-US + en-US + en-US + en-US + + + + + 0 + true + + + + 1 + Primary + 300 + + + + 2 + EFI + 100 + + + + 3 + MSR + 128 + + + + 4 + Primary + true + + + + + + 1 + 1 + + NTFS + DE94BBA4-06D1-4D40-A16A-BFD50179D6AC + + + + 2 + 2 + + FAT32 + + + + 3 + 3 + + + + 4 + 4 + + C + NTFS + + + + + + + + 0 + 4 + + false + + + + + + + VK7JG-NPHTM-C97JM-9MPGT-3V66T + Never + + true + + Claremont MakerSpace + + + + + + false + + + + + 1 + + + + + 0409:00000409 + en-US + en-US + en-US + en-US + + + true + + + 0 + + + -PC + W269N-WFGWX-YVC9B-4J6C9-T83GX + + + + + sawtooth.claremontmakerspace.org + REPLACE_WITH_PASSWORD + administrator + + sawtooth.claremontmakerspace.org + + + + + + + + sawtooth.claremontmakerspace.org + REPLACE_WITH_PASSWORD + administrator + + 1 + powershell -File \\ucs.sawtooth.claremontmakerspace.org\Software\unattend\Set-ComputerName.ps1 + + + + + + + + true + true + true + true + true + true + 1 + + + + + + Administrators + Administrator + + sawtooth.clarmontmakerspace.org + + + + + + false + Eastern Standard Time + + + +