Appleton Posted March 21, 2008 Posted March 21, 2008 I want to be able to grab the serial number of the system with a WMI script and use newsid from sysinternals to assign a new SID as well as rename the computer. The computer name must follow the following format:XXXXMTHYWhere XXXX is the last 4 digits of the serial number of the systemMTH is the current monthand Y is the current year. I have seen a few topics relating to this here, but haven't been able to completely accomplish it yet. Hardest part is grabbing just the last 4 digits of the serial number. Any help would be appreciated.
IcemanND Posted March 22, 2008 Posted March 22, 2008 well if you are using WMI and a VBscript the use the RIGHT(String$,x) command to get the last four characters of the serial number. Then append the month and year to the results.
Appleton Posted March 22, 2008 Author Posted March 22, 2008 Nice, thanks! This is what I have, now I have to figure how to put this result into newsid and I'm finished!Dim objWMI : Set objWMI = GetObject("winmgmts:")Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem")Dim colSettingsBios : Set colSettingsBios = objWMI.ExecQuery("Select * from Win32_BIOS")Dim objComputer, strSerialFor Each objComputer in colSettingsBios strSerial = right(objComputer.SerialNumber,4) & UCase(MonthName(month(date),true)) & right((Year(Date)),1)
Appleton Posted March 22, 2008 Author Posted March 22, 2008 Not too sure if the next line would work for the newsid command, haven't got a box to test it on just yet. Can anyone confirm?Set objShell = CreateObject("WScript.Shell")Set objScriptExec = objShell.Exec("newsid /a " & strSerial)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now