How to force the computer restart requirement via script ?

  • Thread starter Thread starter se2946
  • Start date Start date
S

se2946

When the user changes the "computer name", the system requires "restart
computer".
And the exclamation icon appear onthe system's property window.

Does anybody know how to make a same situation programmatically ?
Is the setting in registry ?
(The exclamation icon is needed.)

I'm coding a script by vbs.
Thank you for help.
 
se2946 said:
When the user changes the "computer name", the system requires "restart
computer".
And the exclamation icon appear onthe system's property window.

Does anybody know how to make a same situation programmatically ?
Is the setting in registry ?
(The exclamation icon is needed.)

I'm coding a script by vbs.
Thank you for help.

Use shutdown.exe for a very simple solution.
Use Win32Shutdown if you prefer a complex approach.
Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\.\root\cimv2")
Set colOs = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOs in colOs
objOs.Win32Shutdown(x)
Next
 
Try
wmic.exe ComputerSystem Where Name="%ComputerName%" Rename
Name="NewComputerName"

or

wmic:root\cli> COMPUTERSYSTEM where "Name='COMPNAME'" CALL Rename NEWNAME,
Password, User
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top