Thursday, May 08, 2008

Fun with imaging - using PING and vbs

Lately, I've been fooling around with an imaging utility called PING. It could be a potential replacement for Zenworks imaging. It's built on top of GNU Parted and Linux From Scratch. Basically, it gives you a way to save an image of a deployed machine to an SMB share (or locally to a separate partition) and then write/restore that image back to the machine. It also has the advantage of including a bunch of system rescue and repair tools.

In a perfect world, we would create our perfect Windows XP image, and then we would set NewSID to run once on boot and to silently set the NETBIOS name to something like "LAW-DELLSVCTAG" or similar with the service being pulled from the BIOS. Here's something that might do that (very slightly modified from a series of postings here :

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, strSerial
For Each objComputer in colSettingsBios
strSerial = objComputer.SerialNumber
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec("newsid /a " & strSerial)
' note that this does not deal with strange serial numbers such as from the parallels virt machines

Assuming that this was saved as "rename.vbs", then we would run the following:

REGEDIT /S %systemdrive%\install\rename.reg,

where "rename.reg" contains the following:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"Rename"="C:\\install\\rename.vbs"

This might cause the rename script to be run the first time that admin logs in.

See, for example, the discussion at this page:
http://board.iexbeta.com/lofiversion/index.php/t62109.html

They are talking about some much more sophisticated stuff. The other option would be to use sysprep.

No comments: