Script to change some Windows settings

Need a script to do the following within Windows 7.

Enable the Administrator user account
Reset/set the Administrator account password to XXXXXXX
Set the Administrator account not to expire the password

Prompt whoever is running the script for a new computer name, then accept input and change the name of the computer.  This needs to check and see if the computer is joined to a domain.  If so, notify user and not allow name change.  If not a domain member then proceed with name change.

These will save me tons of time in a large project I am working on.
murrycAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITEnd-user supportCommented:
Note: This requires user that runs it to be in administrator's group.
Try this on a test station:

@echo off
rem Pre-requisite Step: Change CheckDomain to the name of your domain.
rem To find your domain name:
rem - Go to a computer already joined to the domain.
rem - Run NET CONFIG WORKSTATION
rem - See the value next to: Workstation domain
set CheckDomain=WORKGROUP

rem Enable the Administrator user account
net user administrator /active:yes

rem set/set the Administrator account password to XXXXXXX
net user administrator XXXXXXX

rem Set the Administrator account not to expire the password
WMIC USERACCOUNT WHERE "Name='administrator'" SET PasswordExpires=FALSE

rem Prompt whoever is running the script for a new computer name.
set /p NewName=Enter computer name (no spaces please): 

rem Get machine's domain name
for /f "tokens=1-3 delims= " %%d in ('net config workstation ^| findstr /c:"Workstation 

domain"') do set machinedomain=%%f

rem If the computer is joined to a domain, notify user and not allow name change.
rem If not a domain member then proceed with name change.
if /i "%machinedomain%" equ "%CheckDomain%" (
  echo Cannot rename this computer.
  echo This computer %computername% is already part of domain %CheckDomain%
  pause
) else (
  WMIC computersystem where caption='%computername%' rename %NewName%
  echo Successfully renamed 
  echo Rebooting...
  shutdown /f /r
)

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.