Categories
Welcome Center
Education & Development
Discussions
Certification Preparation
Recent Posts
Groups
Free Resources
Ebooks
Free Workshops
Trending Certifications Infographic
Infosec Training
IT & Security Training
Live Boot Camps
Security Awareness Training
About Infosec Institute
Home
Discussions
Off Topic
Powershell to User Serial Number as Computer Name
the_Grinch
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?
Find more posts tagged with
Save $250 on 2025 certification boot camps from Infosec!
Book now with code EOY2025
Button
Comments
undomiel
I 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 -Restart
crrussell3
What version of powershell? The method undomiel suggested is v3 only I believe.
the_Grinch
Aye, should have put that in three. Version 2.
dbrink
I don't have time to type anything up but check out the "netdom renamecomputer" command. You should be able to use that.
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
INFOSEC Boot Camps
$250
OFF
Use code
EOY2025
to receive $250 off your 2025 certification boot camp!
BROWSE BOOT CAMPS