Tuesday 10 August 2010

Nircmd - when you need batch stuff on remote computers

Nircmd is quite an handy utility, it saves me a lot of work when I need something changed on my site computers.
A sample that shows the flexibility of this great and freeware tool:
- Detect and repair of MS Office is not working since I had a change of the server where Microsoft Office sources where used to install Office, or I want to add a new path (the installer can work with multiple source definitions):
nircmd elevatecmd remote \\hostname_of_computer regsetval sz "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\9040110900063D11C8EF10054038389C\SourceList\Net" "2" "\\new_server\O2003pro3\source"

explanation:

elevatecmd - used to ensure you run the command with administrator rights
remote - run the command remotelly on \\hostname_of_computer
regsetval - set the registry value
sz - the value type is string
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\9040110900063D11C8EF10054038389C\SourceList\Net" - key in registry

    "2" - value name in registry
    "\\new_server\O2003pro3\source" - value data in registry

    If you need to apply that same fix on multiple remote computers, you can do it like this:
    nircmd elevatecmd multiremote "c:\hostnames.txt" sz "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\9040110900063D11C8EF10054038389C\SourceList\Net" "2" "\\new_server\O2003pro3\source"


    The file c:\hostnames.txt must contain host names of the computers where you want this "fix" to be installed (line by line).

    (more to come)

    No comments:

    Post a Comment