Hi I use the below vbscript to download shares from remote machine but
it gives the error as C:shares.vbs(7, 1) (null): 0x80041003 can
anybody help me.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:" & strComputer & "rootcimv2")
set colShares = objWMI.InstancesOf("Win32_Share")
for each objShare in colShares
WScript.Echo objShare.Name
WScript.Echo " Path: " & objShare.Path
WScript.Echo " Allow Max: " & objShare.AllowMaximum
WScript.Echo " Caption: " & objShare.Caption
WScript.Echo " Max Allowed: " & objShare.MaximumAllowed
WScript.Echo " Type: " & objShare.Type
WScript.Echo
next
VB script to download shares
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
VB script to download shares
Hi I use the below vbscript to download shares from remote machine but
it gives the error as C:shares.vbs(7, 1) (null): 0x80041003 can
anybody help me.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:" & strComputer & "rootcimv2")
set colShares = objWMI.InstancesOf("Win32_Share")
for each objShare in colShares
WScript.Echo objShare.Name
WScript.Echo " Path: " & objShare.Path
WScript.Echo " Allow Max: " & objShare.AllowMaximum
WScript.Echo " Caption: " & objShare.Caption
WScript.Echo " Max Allowed: " & objShare.MaximumAllowed
WScript.Echo " Type: " & objShare.Type
WScript.Echo
next
it gives the error as C:shares.vbs(7, 1) (null): 0x80041003 can
anybody help me.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:" & strComputer & "rootcimv2")
set colShares = objWMI.InstancesOf("Win32_Share")
for each objShare in colShares
WScript.Echo objShare.Name
WScript.Echo " Path: " & objShare.Path
WScript.Echo " Allow Max: " & objShare.AllowMaximum
WScript.Echo " Caption: " & objShare.Caption
WScript.Echo " Max Allowed: " & objShare.MaximumAllowed
WScript.Echo " Type: " & objShare.Type
WScript.Echo
next
VB script to download shares
So when you change the value of strComputer to a remote machine you get the error? Does it work for the localhost? It works fine for me both ways. What OS is on the remote computer? Are you running it with admin credentials for the remote computer? What happens when you use WBEMTest and run a query like "Select * from win32_Share" ?It looks like you're failing to make a WMI connection and return any data.
VB script to download shares
So when you use Wbemtest to connect to the remote machine, can you successfully run the query with your current credentials, or do you need to specify admincredentials? If the latter, then you need to rewrite your script using the SWbemscripting object which allows you to specify alternate credentials.
VB script to download shares
Hi, yes you are right I am able to connect to remote machine using
Wbemtest by specifying alternate admincredentials. Pls help me how to
rewrite my scriot to specify alternate credentials
Wbemtest by specifying alternate admincredentials. Pls help me how to
rewrite my scriot to specify alternate credentials