Essentially I am attempting to rename computers to a generic standard of [CompanyInitials]-[SerialTag] (i.e ABC-J45TYF7) using a GPO with a powershell startup script. My goal is to not have to manually go around and rename every computer in our network. Here is the basic script: *I stripped out all the try/catch blocks and log writing functions for easier reading…
Powershell
#Gathering current computer name and creating the new companystandardofABC-SERIALTAG# into variables$CompName=$env:COMPUTERNAME$SerialTag=gwmiwin32_bios|select-ExpandPropertyserialnumber$CompNameSerial="ABC-$SerialTag"#If names don’t match, rename computer if($CompName-ne$CompNameSerial){#Creates PSCredential Object used for Rename-Computer Domain Credentials$User="DOMAIN\ADMIN"$PasswordFile="\\SERVER\SHARE\PATHTOFILE\secureString.txt"...