Login | |
|
 |
RE: AD to Access - 1/18/2007 7:03:58 AM
|
|
 |
|
| |
dm_4ever
Posts: 2722
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
That probably has to do with what I told you to look out for. There may be some machine's you can't connect to (turned off, not enough permissions, WMI is broken, etc.). Have you verified strComputers = objRecordsetAD.Fields("Name").Value is providing a computername? I don't think you need this either since you're querying AD: Dim oContainer 'Initialize global variables Set oContainer=GetObject("LDAP://cn=Computers,DC=corp-nj,DC=mrsassociates,dc=com ")
_____________________________
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
|
|
| |
|
|
|
 |
RE: AD to Access - 1/18/2007 7:19:17 AM
|
|
 |
|
| |
dm_4ever
Posts: 2722
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
You mentioned it yourself, the error is with this line: Set objWMIService = GetObject("winmgmts:\\" & strComputers & "\root\cimv2") which means you're querying AD just fine, but having issues connecting via WMI to the machine. The piece below may help get over the problem computer, but you may want to think of a better method to handle errors. Perhaps add logging for machine's you're unable to connect via WMI for whatever reason. Do Until objRecordSetAD.EOF ' ================================================================================================== ' Grabs Computer Name, Manufacturer, Model, and Installed Ram from the ComputerSystem WMI Service '=================================================================================================== strComputers = objRecordsetAD("Name") On Error Resume Next Set objWMIService = GetObject("winmgmts:\\" & strComputer& "\root\cimv2") If Err.Number <> 0 Then 'if you get an error trying to connect then move to the next computer On Error GoTo 0 objRecordsetAD.MoveNext End If objRecordset.AddNew
_____________________________
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
|
|
| |
|
|
|
 |
RE: AD to Access - 1/18/2007 7:25:47 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
|
I would add this just to be on the safe side: strComputers = objRecordsetAD("Name") On Error Resume Next Set objWMIService = GetObject("winmgmts:\\" & strComputer& "\root\cimv2") If Err.Number <> 0 Then 'if you get an error trying to connect then move to the next computer On Error GoTo 0 objRecordsetAD.MoveNext End If On Error Goto 0 objRecordset.AddNew
_____________________________
"... 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
|
|
| |
|
|
|
|