I would like to create a script that will run at either startup or shutdown(whichever I can get working) in a GPO that will rename a domain computer based off of what is put into the description field of the machine account in AD. I wrote something in VBS that grabs the description field of the computer that the script is running on and checks its desc field in AD for the identifier RENAME:. If RENAME: is present in the desc field it takes what is after RENAME: (i.e. RENAME:IT-COMP-01) and stores that into a variable that will be used as the computer's new name. This part is working fine but the part I am stuck at is the actual renaming part. I wanted to use NETDOM but NETDOM isn't installed by default in Windows 7 and I feel a little uncomfortable including the domain and local admin credentials in the script. I am not very familiar with powershell so wanted to get some input on wether or not I can follow the same procedure as above in powershell to rename the computer based on the AD computer account desc field while keeping admin credentials secure?
Appreciate all help.