Re: How to force the computer restart requirement via script ?
"se2946" <se2946@discussions.microsoft.com> wrote in message
news:75C75D55-12BE-4169-B615-20A704194965@microsoft.com...
> 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=impersonat e,(Shutdown)}\\.\root\cimv2")
Set colOs = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOs in colOs
objOs.Win32Shutdown(x)
Next
RE: How to force the computer restart requirement via script ?
Try
wmic.exe ComputerSystem Where Name="%ComputerName%" Rename
Name="NewComputerName"
or
wmic:root\cli> COMPUTERSYSTEM where "Name='COMPNAME'" CALL Rename NEWNAME,
Password, User
"se2946" wrote:
> 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.