issue in finding the share
Hi ,
I'm not able to find wether a particular share exists or not in a server.
I use a script.
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLev el=Pkt}!\\"_
& strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Share where Name = '"&"sharename"&"'")
If (colItems.Count = 1) then
Wscript.Echo "The share exists"
Else
Wscript.Echo "The share does not exists"
End If
to find wether share exists or not this script works fine on all the servers except one. It gives error "Provider load failure"
I checked the "WMI controls" permissions , DCOM permissions and gave full rights. I even tried to raise the security level in the code using
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer (strComputer, "root\CIMV2", username, Password)
objWMIService.Security_.impersonationlevel = 3
Still I'm not able to get the share name from the server.
Am I missing any thing? . or if any one has any suggessions please let me know.
|