Hi,
Im trying to query my servers health through VBScript but without luck.
My script only returns "Access denied" (or similar...).
The script is run from a Win2000 server and query other Win2000 servers.
I guess i must have a user account on the remote machine, i´ve created a new user and added this to Administrator-group, i then try to send this userinformation with the script (strUser & strPassword) but without luck.
* I dont want to put one script on each server which is running local... *
Best regards
Robert
--- script ---
Option Explicit
Dim strComputer, strUser, strPassword
Do
strComputer = inputbox( "Please enter computername (or . for local host)", "Input" )
Loop until strComputer <> ""
Do
strUser = inputbox( "Please enter username", "Input" )
Loop until strUser <> ""
Do
strPassword = inputbox( "Please enter password", "Input" )
Loop until strPassword <> ""
ListShares strComputer, strUser, strPassword
WScript.Echo vbCrlf & "Ready."
Sub ListShares( strComputer, strUser, strPassword )
Dim strObject
Dim objLocator, objWMIService, objShare
Dim colShares
Set objLocator = CreateObject("WbemScripting.SWbemLocator"
Set objWMIService = objLocator.ConnectServer(strComputer, "root\cimv2"', strUser, strPassword)
objWMIService.Security_.ImpersonationLevel = 3
Set colShares = objWMIService.ExecQuery( "Select * from Win32_Share" )
For Each objShare In colShares
Wscript.Echo objShare.Name & " [" & objShare.Path & "]"
Next
End Sub
--- //end script ---
Im trying to query my servers health through VBScript but without luck.
My script only returns "Access denied" (or similar...).
The script is run from a Win2000 server and query other Win2000 servers.
I guess i must have a user account on the remote machine, i´ve created a new user and added this to Administrator-group, i then try to send this userinformation with the script (strUser & strPassword) but without luck.
* I dont want to put one script on each server which is running local... *
Best regards
Robert
--- script ---
Option Explicit
Dim strComputer, strUser, strPassword
Do
strComputer = inputbox( "Please enter computername (or . for local host)", "Input" )
Loop until strComputer <> ""
Do
strUser = inputbox( "Please enter username", "Input" )
Loop until strUser <> ""
Do
strPassword = inputbox( "Please enter password", "Input" )
Loop until strPassword <> ""
ListShares strComputer, strUser, strPassword
WScript.Echo vbCrlf & "Ready."
Sub ListShares( strComputer, strUser, strPassword )
Dim strObject
Dim objLocator, objWMIService, objShare
Dim colShares
Set objLocator = CreateObject("WbemScripting.SWbemLocator"
Set objWMIService = objLocator.ConnectServer(strComputer, "root\cimv2"', strUser, strPassword)
objWMIService.Security_.ImpersonationLevel = 3
Set colShares = objWMIService.ExecQuery( "Select * from Win32_Share" )
For Each objShare In colShares
Wscript.Echo objShare.Name & " [" & objShare.Path & "]"
Next
End Sub
--- //end script ---