Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Access Denied

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,48633
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Access Denied
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Access Denied - 6/22/2007 5:59:48 AM   
  gotoloop

 

Posts: 7
Score: 0
Joined: 6/18/2007
Status: offline
Thsi script works on local PC but when I set strcomputer to a different computer I get access denied on getobject.  I am admin on all Boxes? Any thoughts?
Const HKLM = &H80000002 ' HKEY_LOCAL_MACHINE
Const REG_SZ = 1 ' String value in registry (Not DWORD)
Const ForReading = 1
Const ForWriting = 2

Set objshell = WScript.Createobject("WScript.Shell")
strcomputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

sidkeypath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\"
objreg.enumkey HKLM, sidkeypath, arrKeys
For Each subkey In arrkeys
sid1 = (Right(subkey,3))
 Select Case sid1
   Case 500
   sid = (Left(subkey,38))
   WScript.Echo sid
 End Select 
Next
 
 
Post #: 1
 
 RE: Access Denied - 6/22/2007 2:51:39 PM   
  dm_4ever


Posts: 2663
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Do you get the same error when you run it locally on that other computer?  If not, you may want to check the registry. 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole

EnableDCOM:Y
EnableRemoteConnect:Y

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to gotoloop)
 
 
Post #: 2
 
 RE: Access Denied - 6/26/2007 5:25:48 AM   
  gotoloop

 

Posts: 7
Score: 0
Joined: 6/18/2007
Status: offline
It was actually WMI quit working all together.  Known scripts were not working no foreign scripts could be run on my system complete overhaul. 

(in reply to gotoloop)
 
 
Post #: 3
 
 RE: Access Denied - 6/26/2007 5:59:36 AM   
  ebgreen


Posts: 5034
Score: 31
Joined: 7/12/2005
Status: online
Do you have SMS deployed on the machine?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to gotoloop)
 
 
Post #: 4
 
 RE: Access Denied - 6/27/2007 6:07:15 AM   
  gotoloop

 

Posts: 7
Score: 0
Joined: 6/18/2007
Status: offline
Yes I do...  any particualar reason you ask that?

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Access Denied - 6/27/2007 6:15:20 AM   
  ebgreen


Posts: 5034
Score: 31
Joined: 7/12/2005
Status: online
Because SMS just loves to jack up WMI repositories whenever it gets the chance.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to gotoloop)
 
 
Post #: 6
 
 RE: Access Denied - 6/27/2007 8:59:45 AM   
  Rischip


Posts: 502
Score: 2
Joined: 3/26/2007
Status: offline
There are really 4 things to try.

1)     First and foremost try this change to your code

       Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default\ms_409:StdRegProv")

       (I've seen some machines where the stdregprov class gets moved to ms_409, I believe it has to do with a specific patch level and DOTNET runtime combination, but I don't have that information handy)


2)     You can restore a WMI respository from a backup of another machine with identical applications installed (a little risky, but sometimes works)

3)     Try this to refresh and rebuild WMI

       cd /d %windir%\system32\wbem
       for %i in (*.dll) do RegSvr32 -s %i
       for %i in (*.exe) do %i /RegServer

4)     Or as a last resort try:

       rundll32.exe setupapi,InstallHinfSection WBEM 132 %windir%\inf\wbemoc.inf

The above line will completely reinstall WMI, but you might lose some WMI providers that have been installed since Windows was installed. It also might require the Windows Installation CD.


_____________________________

Rischip
Author of - The Grim Linker

(in reply to gotoloop)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Access Denied Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts