Christian's blog

The usual IT babble

RSS Feeds

  • Home
  • About Me
  • HOWTO’s
    • XBMC installation Guide
  • Certifications
    • Microsoft
    • VMware
  • Projects
    • RPMS for ESX 3.5
    • RPMS for SLES9
    • RPMS for SLES10
    • RPMS for SLES11

VBscript: Query remote OS and SP info (continued)

Feb 15th

Posted by Christian in Life

After some more crunching on my VBscript, I think I finally have a working script that runs through a csv-list I point it to and walk onto each system (by ip-address only sadly) and query the os and the Service Pack that is installed. The CSV may look like this:

Hostname;IP;Model;Description;OS;Service-Pack;BL;Priority
epimetheus;10.0.0.2;VMware guest;File-Server
hades;10.0.0.1;VMware guest;Core-Router

After saving that one, and running a cscript //NoLogo win_sp_level.vbs you should find a completed list like this:

Hostname;IP;Model;Description;OS;Service-Pack;BL;Priority
epimetheus;10.0.0.2;VMware guest;File-Server;Windows Server 2003 Standard x64 Edition; SP1;;
hades;10.0.0.1;VMware guest;Core-Router;Windows Server 2003 Enterprise Edition; SP0;;

The final script looks like this:

On Error Resume Next
 
Set objFSO = CreateObject("Scripting.FileSystemOBject")
 
If objFSO.FileExists("Rollout_SP2.csv") = 0 Then
  CleanUp()
  Wscript.Quit
End If
 
Set CSVin = objFSO.OpenTextFile("Rollout_SP2.csv", 1)
CSVin_read = CSVin.ReadLine
 
Set objFile = objFSO.CreateTextFile("Rollout_SP2_result.csv")
Set objFile = nothing
Set CSVout = objFSO.OpenTextFile("Rollout_SP2_result.csv", 8)
CSVout.WriteLine("Hostname;IP;Model;Description;OS;Service-Pack;BL;Priority")
 
Do While CSVin.AtEndofStream <> True
 
  Dim os, servicepack
  Dim user, password
 
  os = nothing
  servicepack = nothing
  user = vars(1) & "\chrischie"
  password = "hah-this-password-is-easy"
 
  current_line = CSVin.ReadLine
  vars = Split(current_line, ";")
 
  Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
  Set objSWbemServices = objSWbemLocator.ConnectServer _
    (vars(1), "root\cimv2", user, password, "MS_409",, 128)
 
  objSWbemServices.Security_.ImpersonationLevel = 3
 
  Set colOperatingSystems = objSWbemServices.ExecQuery _
    ("Select * from Win32_OperatingSystem")
 
  ' The set returns an Err.Number of 91 on success
  ' Don't ask me why though.
  If Err.Number <> 91 Then
    CSVout.WriteLine(vars(0) & ";" & vars(1) & ";" & vars(2) & ";" & vars(3) & ";NA;SP?;;")
  Else
    For Each objOperatingSystem in colOperatingSystems
      os = objOperatingSystem.Caption
      servicepack = objOperatingSystem.ServicePackMajorVersion
    Next
    CSVout.WriteLine(vars(0) & ";" & vars(1) & ";" & vars(2) & ";" & vars(3) _
	                 & ";" & os  & "; SP" & servicepack & ";;")
  End If
Loop

The only thing I still need to improve is the error handling (as in notify when a system is being skipped due to RPC being unavailable).

Service Pack, Vbscript, Windows Server 2003, WMI, Work

Converting TIVSM RPMs to deb

Feb 15th

Posted by Christian in Life

1 comment

We received a preinstalled customer server the other day, for which we had declared “as-is” support only, since it is running Lucid Lynx. Now today, I started getting the TSM client to work. Was kinda weird, since at first dsmc was reporting something like this:

# ./dsmc: no such file or directory

After fiddling with it a bit more, here are the control files, as well as the prerm and postinst-scripts for TIVSM-API, TIVSM-API64 and TIVSM-BA:

tivsm-api/debian/control:

Source: tivsm-api
Section: non-free
Priority: extra
Maintainer: root <root@localhost>
 
Package: tivsm-api
Architecture: all
Depends: ${shlibs:Depends}
Description: IBM Tivoli Storage Manager API

tivsm-api/debian/tivsm-api.postinst:

for library in /opt/tivoli/tsm/client/api/bin/*.so; do
        ln -s $library /usr/lib/${library##*/}
done
 
# Automatically added by dh_makeshlibs
if [ "$1" = "configure" ]; then
        ldconfig
fi
# End automatically added section

tivsm-api/debian/tivsm-api.prerm:

for library in /opt/tivoli/tsm/client/api/bin/*.so; do
        rm -f /usr/lib/${library##*/}
done

tivsm-api64/debian/control:

Source: tivsm-api64
Section: non-free
Priority: extra
Maintainer: root <root@localhost>
 
Package: tivsm-api64
Architecture: amd64
Depends: ${shlibs:Depends}
Description: IBM Tivoli Storage Manager API

tivsm-api64/debian/postinst:

for library in /opt/tivoli/tsm/client/api/bin64/*.so; do
        ln -s $library /usr/lib64/${library##*/}
done
 
# Automatically added by dh_makeshlibs
if [ "$1" = "configure" ]; then
        ldconfig
fi
# End automatically added section

tivsm-api64/debian/prerm:

for library in /opt/tivoli/tsm/client/api/bin64/*.so; do
        rm -f /usr/lib64/${library##*/}
done
 
# Automatically added by dh_makeshlibs
if [ "$1" = "configure" ]; then
        ldconfig
fi
# End automatically added section

tivsm-ba/debian/control:

Source: tivsm-ba
Section: non-free
Priority: extra
Maintainer: root <root@localhost>
 
Package: tivsm-ba
Architecture: any
Depends: ${shlibs:Depends}, lib32stdc++6 [amd64], libc6-i386 [amd64], lib32gcc1 [amd64]
Description: IBM Tivoli Storage Manager Client

tivsm-ba/debian/tivsm-ba.postinst:

ln -s /opt/tivoli/tsm/client/lang/EN_US /opt/tivoli/tsm/client/ba/bin/EN_US
 
for binary in dsmadmc dsmagent dsmc dsmcad dsmj dsmswitch dsmtca dsmtrace; do
        ln -s /opt/tivoli/tsm/client/ba/bin/$binary /usr/bin/$binary
done

tivsm-ba/debian/tivsm-ba.prerm:

rm -f /opt/tivoli/tsm/client/ba/bin/EN_US
 
for binary in dsmadmc dsmagent dsmc dsmcad dsmj dsmswitch dsmtca dsmtrace; do
        rm -f /usr/bin/$binary
done

All that was left to do, was simply adding a -n to the dh_makeshlibs call in each packages debian/rules file, otherwise dh_makeshlibs would overwrite my shiny postinst/prerm actions!

Lucid Lynx, TSM, Ubuntu, Work
«12345»102030...Last »
  • Categories

    • Gentoo (38)
    • Life (297)
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Random Quote

    No matter how busy you may think you are, you must find time for reading, or surrender yourself to self-chosen ignorance. — Confucius

Copyright © 2010 Christian's blog