Jump to content

bbright20

Members
  • Posts

    2
  • Joined

  • Last visited

Reputation

0 Neutral

About bbright20

  1. Here is what I have so far - I'm able to rename the computer with the prompt boxes I want and force a restart. ''Rename computer dim LocID, TermID, objFSO, objTextFile, oShell Const ForReading = 1, ForWriting = 2, ForAppending = 8 LocID=InputBox("Location ID:") TermID=InputBox("Terminal Number:") Set WshNetwork = WScript.CreateObject("WScript.Network") strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colComputers = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") For Each objComputer in colComputers err = objComputer.Rename("IITGS" & LocID & "-" & TermID) Next ''Set Computer Description Set Obj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2").ExecQuery("Select * FROM Win32_OperatingSystem") For Each object In Obj object.Description = ("IITGS" & LocID & "-" & TermID) object.Put_ Next 'messagebox msgbox "Computername and description changed to " & "IITGS" & LocID & "-" & TermID Set oShell=CreateObject("Wscript.Shell") oShell.Run "%comspec% /c shutdown /r /t 5 /f", , TRUE I'm working on a seperate script now to join the domain. If anyone has any input as to how I can make this script act the way I want above (rename/restart/join/restart) all in one script, that would be awesome. And yes, I know my coding is EXTREMELY crude. I'm working on a tight timeline here and am just trying to get it to work. Cleanup can come later.
  2. Hi, I'm looking for a vbs script or a batch file that will rename a computer (with user input for 2 fields) in both the description and the actual computer name. The format will always be the same: NAME(Input1)-(Input2) Once the computer is renamed, then need it joined to a domain. Joining should require little to no input from the user (the script can hold the credentials). Ideally, the script would rename, restart, join, restart. If it's only possible to rename/restart and then run a second script for joining/restarting, that's fine too but it would be preferential if this did everything automatically. If at all possible, maybe a message box after each step would be great as well (renaming finishes, message box says "computer renamed to 'comp name'") and the same for the domain. Also, if the script could delete itself when all is done, that would be even better! I've been searching for the past few days and have been unsuccessful in finding a script that I can modify with my needs and get the results I'm looking for. Any help would be greatly appreciated. Thanks!
×
×
  • Create New...