Re: Remote WMI problem...Permission Denied:'getobject'

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.


.



Relevant Pages

  • Re: Regular Expressions
    ... Const OpenAsASCII = 0 ... Set oFSO = CreateObject ... bCheckForG1AtNextLoop = False ' init value ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.inetsdk.programming.scripting.vbscript)
  • Re: Get & Set Services status per script ?
    ... Const OpenAsASCII = 0 ... sComputer = oWshNet.ComputerName ... On Error Goto 0 ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)
  • Re: Disconnect user after closed IE
    ... ' will ' actually end up as a forced shutdown (a bug in the WMI ... use "Logoff" instead of "Logoff_Force". ... Const EWX_SHUTDOWN = 1 ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.wsh)
  • Re: Remove Blank Line and/or Additional CRLF From End of File
    ... > per line Lawson extract file, so it can be imported into our check writing ... Const OverwriteIfExist = -1 ... Dim fso, strFiles, strSourceFile, strOutputFile, strOutputLine ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)
  • Re: Randomising a text file
    ... > it and overwrite the original? ... Const OpenAsASCII = 0 ... Dim arOut ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)