![]() ![]() Question = MsgBox("PC name will change " & DblQuote(strNewName) & " after restarting this computer" & vbCrLf &_ Set Obj= GetObject("winmgmts:\\" & strComputer).InstancesOf("Win32_OperatingSystem") ![]() If strDescription = "" Then Wscript.Quit() StrDescription = Inputbox("Enter Description : ",Title,"Machine blalllaaaaaaa") Set colComputers = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem") StrNewName = Inputbox ("Enter the new name of the PC : ",Title,"Salle-Poste") Set objWMIService = GetObject("winmgmts:" _ 'If you want to change the description of the computer, you should uncomment this line : , DblQuote(WScript.ScriptFullName) & " /elevate", "", "runas", 1 If Not ("elevate") ThenĬreateObject("Shell.Application").ShellExecute DblQuote(WScript.FullName) _ This will rename the computer and immediately restart.ĭim Title,strComputer,objWMIService,strNewName,objComputerĭim Obj,Question,err,strDescription,colComputers,x ![]() Example: Rename-Computer -NewName NewComputerName -Restart Powershell 3.0 (Windows 8) introduced the Rename-Computer cmdlet. If the computer name has dashes or other special characters you need to quote the computer name WMIC ComputerSystem where Name="COMPUTER-NAME" call Rename Name=NewName A quick google brings this command : WMIC ComputerSystem where Name=COMPUTERNAME call Rename Name=NewName ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |