Jump to content

Covert Ops

Member
  • Posts

    3
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Canada

About Covert Ops

Covert Ops's Achievements

0

Reputation

  1. I am just trying to provide a template for Covert Ops, it would be up to him to edit it to what he wanted. This worked for me. I modified it to just output D- or M- Thank you all for the help!!
  2. Great! Thanks for the help guys. I think this will work well: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colChassis = objWMIService.ExecQuery _ ("Select * from Win32_SystemEnclosure") For Each objChassis in colChassis For Each strChassisType in objChassis.ChassisTypes Wscript.Echo strChassisType Next Next But I am not sure how to incorporate it into my previous script, and then have it enter a D- or M- at the beginning of the computer name
  3. Hello I am trying to rename a bunch of workstations based on their serial number, and then a "D-" at the beginning if it is a workstation, and a "M-" if it is a notebook/laptop For example a workstation would be renamed to D-SN12345 and a laptop would be renamed to M-SN12345 So far I have this: Set objNetwork = CreateObject("WScript.Network") strComputer = objNetwork.ComputerName Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _ strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _ strComputer & "'") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48) For Each objItem in colItems strMsg = objItem.Caption If strMsg = "Microsoft Windows XP Professional" Then winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//." 'WScript.Echo winmgmt1 Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS") for each SN in SNSet If SN.SerialNumber = strComputer Then MsgBox "Computer name already set! Name is: "& strComputer Wscript.Quit End If If SN.SerialNumber = "" Then MsgBox "Problem with computer naming!" Wscript.Quit End If ErrCode = objComputer.Rename(SN.SerialNumber, strPassword, strUser) If ErrCode = 0 Then MsgBox "Computer renamed successfully to: "& SN.SerialNumber End If Next End If Next This works well, but I am not sure how to go about determining if the computer is a workstation or a notebook, and then how to go about adding it to the beginning of the computer name I did not write the script above, and I have very limited scripting knowledge Any help would be GREATLY appreciated
×
×
  • Create New...