16.01.2013 Views

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Ipswitch</strong> <strong>WhatsUp</strong> <strong>Gold</strong> <strong>User</strong> <strong>Guide</strong><br />

Function GetCurrentLogin<strong>User</strong>(sComputer, sAdminName, sAdminPasswd)<br />

GetCurrentLogin<strong>User</strong>=Null<br />

Set oSWbemLocator = CreateObject("WbemScripting.SWbemLocator")<br />

On Error Resume Next<br />

Set oSWbemServices = oSWbemLocator.Connect<strong>Server</strong> _<br />

(sComputer, "root\cimv2",sAdminName,sAdminPasswd)<br />

If Err.Number 0 Then<br />

End If<br />

Context.LogMessage("The 1st try to connect to " & sComputer & " failed. Err:" & Err.Description)<br />

Err.Clear<br />

'If the specified user name and password for WMI connection failed, then<br />

'try to connect without user name and password. Can't specify user name<br />

'and password when connecting to local machine.<br />

On Error Resume Next<br />

Set oSWbemServices = oSWbemLocator.Connect<strong>Server</strong>(sComputer, "root\cimv2")<br />

If Err.Number 0 Then<br />

End If<br />

Err.Clear<br />

On Error Resume Next<br />

Context.SetResult 1,"Failed to access " & sComputer & " " & _<br />

"using username:" & sAdminName & " password." & " Err: " & Err.Description<br />

Exit Function<br />

Set colSWbemObjectSet = oSWbemServices.InstancesOf("Win32_ComputerSystem")<br />

919

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!