Re: Remote WMI problem...Permission Denied:'getobject'
- From: "Pete" <xla760@xxxxxxxxxxxxxxx>
- Date: Fri, 21 Oct 2005 11:40:00 +0100
Try using wbem to connect to remote workstations, also allows passing admin
credentials.
UserName = ""
Password = ""
Computer = "station100"
Const CONVERSION_FACTOR = 1047586
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService =
SWBemlocator.ConnectServer(Computer,"\root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk
where DeviceID='C:'",,48)
For Each objLogicalDisk in colItems
FreeMegabytes = objLogicalDisk.freespace / CONVERSION_FACTOR
Next
WScript.Echo int(FreeMegabytes)
Pete Forman
"Perry" <Perry@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7D530F4C-A297-4CEE-8BFD-7E6FEC0969CC@xxxxxxxxxxxxxxxx
>I am a scripting newbie. I have this little script that I an using to take
> baby steps into scripting:
>
> const CONVERSION_FACTOR = 1047586
> Computer = "station100"
> Set objWMIService = GetObject("winmgmts://" & Computer)
> Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='c:'")
> FreeMegabytes = objLogicalDisk.freespace / CONVERSION_FACTOR
> wscript.echo "There are",int(FreeMegabytes) ,"MB of Free Space"
>
> The script works well locally. However it fails when trying to retrieve
> information from any other computer in my WORKGROUP. If I specfy any other
> computer name other that the local machine, I get "code 800A0046 Error:
> permission denied: getobject'".
>
> I thought this might be a Windows XP SP2 problem so I tried all of the
> fixes
> in MS KB Article ID 875606. No luck. Tried adjusting rights in WMI
> properties
> on both computers. No luck
>
> I am logged on LOCALLY (same name) to both Win XP machines with
> administrator rights. The network environment is a workgroup. I can access
> resources back and forth from both machines. However, using Computer
> Management Console, I can only view details locally on both machines. I
> can
> see nothing remotely on Computer Management console. This is true whether
> or
> not Windows Firewalls are enabled or disabled.
>
> I think there is a problem with WMI and the workgroup environment, but I
> can't figure out what.
>
> Any help would be appreciated.
.
- Follow-Ups:
- Prev by Date: Re: Copying security acl's from one printer to another?
- Next by Date: Re: Date-Time formatting
- Previous by thread: Re: Remote WMI problem...Permission Denied:'getobject'
- Next by thread: Re: Remote WMI problem...Permission Denied:'getobject'
- Index(es):
Relevant Pages
|