RE: Permission Denied 800A0046 GetObject
- From: "Lucy Phelan" <LucyPhelan@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 28 Oct 2005 13:59:13 -0700
Actually I got the script working via a text file containing the names of the
computers...my guess is that I don't have some kind of permission to Active
Directory to retrieve the information I was looking for...although I am a
Domain Admin as well as Enterprise Admin, but I guess this impersonation
thing might have something to do with it...still am curious as to how to get
this working in the future using Active Directory and Ldap names.
Here is the script that ended up working for me and I ran it from a command
prompt, i.e. cscript proxysettings_mult.vbs > proxyreport.txt
On Error Resume Next
INPUT_FILE_NAME = "C:\Scripts\Computers.txt"
Const FOR_READING = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
strComputers = objFile.ReadAll
objFile.Close
arrComputers = Split(strComputers, vbCrLf)
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\root\cimv2\Applications\MicrosoftIE")
Set colIESettings = objWMIService.ExecQuery _
("Select * from MicrosoftIE_LANSettings")
For Each strIESetting in colIESettings
wscript.Echo "Computer Name: " & strComputer
Wscript.Echo "Autoconfiguration proxy: " & strIESetting.AutoConfigProxy
Wscript.Echo "Autoconfiguration URL: " & strIESetting.AutoConfigURL
Wscript.Echo "Autoconfiguration Proxy detection mode: " & _
strIESetting.AutoProxyDetectMode
Wscript.Echo "Proxy: " & strIESetting.Proxy
Wscript.Echo "Proxy override: " & strIESetting.ProxyOverride
Wscript.Echo "Proxy server: " & strIESetting.ProxyServer & vbCrLf
Next
Next
"Lucy Phelan" wrote:
> I am trying to run the following script:
> 'On Error Resume Next
> set colComputers = GetObject("LDAP://OU=Desktops, DC=warren,
> DC=interlink-intranet, DC=net")
> For Each objComputer in colComputers
> strComputer = objComputer.CN
> Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> Set colItems = objWMIService.ExecQuery("Select * from Win32_Proxy",,48)
> For Each objItem in colItems
> Wscript.Echo "Caption: " & objItem.Caption
> Wscript.Echo "Description: " & objItem.Description
> Wscript.Echo "ProxyPortNumber: " & objItem.ProxyPortNumber
> Wscript.Echo "ProxyServer: " & objItem.ProxyServer
> Wscript.Echo "ServerName: " & objItem.ServerName
> Wscript.Echo "SettingID: " & objItem.SettingID
> Next
> Next
>
> and I get an error 800A0046 Permission Denied error on GetObject...now I get
> the fact that it is a permission problem but how can I resolve it so that I
> can get the proxy info from the computers in my domain that I desire?
>
> Thanks in advance.
.
- Prev by Date: Re: [MSH]How to get the red "PDC prompt"
- Next by Date: [MSH] pretty XML printing
- Previous by thread: Files and Settings Transfer Wizard scripting
- Next by thread: [MSH] pretty XML printing
- Index(es):
Relevant Pages
|