Powershell to User Serial Number as Computer Name
the_Grinch
Member Posts: 4,165 ■■■■■■■■■■
in Off-Topic
I'm attempting to automate a couple of our processes and hoping Powershell can help (I really need to get the book and learn it). So I know how to pull the serial number:
Get-WMIObject -Class "Win32_BIOS" -Computer computername | select SerialNumber
Once it outputs the serial number, I want to take it and use it to name the computer thus:
DELXXXXXXX
Any clues on how I could do this?
Get-WMIObject -Class "Win32_BIOS" -Computer computername | select SerialNumber
Once it outputs the serial number, I want to take it and use it to name the computer thus:
DELXXXXXXX
Any clues on how I could do this?
WIP:
PHP
Kotlin
Intro to Discrete Math
Programming Languages
Work stuff
PHP
Kotlin
Intro to Discrete Math
Programming Languages
Work stuff
Comments
-
undomiel Member Posts: 2,818I believe a script like this would serve the purpose:
$biosstring = Get-WMIObject -Class "Win32_BIOS" -ComputerName $args[0]
$newname = "DEL" + $biosstring.SerialNumber
$domaincredential = Get-Credential
Rename-Computer -ComputerName $args[0] -NewName $newname -DomainCredential $domaincredential -Force -RestartJumping on the IT blogging band wagon -- http://www.jefferyland.com/ -
crrussell3 Member Posts: 561What version of powershell? The method undomiel suggested is v3 only I believe.MCTS: Windows Vista, Configuration
MCTS: Windows WS08 Active Directory, Configuration -
the_Grinch Member Posts: 4,165 ■■■■■■■■■■Aye, should have put that in three. Version 2.WIP:
PHP
Kotlin
Intro to Discrete Math
Programming Languages
Work stuff -
dbrink Member Posts: 180I don't have time to type anything up but check out the "netdom renamecomputer" command. You should be able to use that.Currently Reading: Learn Python The Hard Way
http://defendyoursystems.blogspot.com/