VBS Script (template) not Polling Remote Computer Correcty

VBS Script (template) not Polling Remote Computer Correcty

I created a script to poll a server's uptime in minutes using VBS and WMI.  The problem seems to be the strComputer = "."  command it ends up polling the Opmanager server's uptime.  If I put the device variable or the specific server name it throws errors errors like: Microsoft VBScript runtime error: Permission denied: 'GetObject'  (on a w2003 machine) , (null): 0x80041003 (on W2008 or w2000).
 
The command line is: cscript //nologo ${FileName}.vbs ${DeviceName} ${UserName} ${Password} svchost.exe
 
the body:
  1. strComputer = "."
  2. Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colOperatingSystems = objWMIService.ExecQuery _
        ("Select * from Win32_OperatingSystem")
     
    For Each objOS in colOperatingSystems
        dtmBootup = objOS.LastBootUpTime
        dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
        dtmSystemUptime = DateDiff("n", dtmLastBootUpTime, Now)
        Wscript.Echo "Message: System Uptime Alarm"
        Wscript.Echo "Data:"
        Wscript.Echo "Uptime"&vbTab& dtmSystemUptime
        WScript.Quit(0)
    Next
     
    Function WMIDateStringToDate(dtmBootup)
        WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & _
            Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _
                & " " & Mid (dtmBootup, 9, 2) & ":" & _
                    Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2))
    End Function


















                New to ADSelfService Plus?