Jump to content

Recommended Posts

Posted

Ok... A on a few occasions now when I logon to my vista machine I get an Access Denied error on VBS Script which is only mapping network drives and printers [800A0046] - of which the code is pasted below.

 

I have full admin and domain rights and this only occurs on Vista - on XP it's not a problem.

 

I use Roaming Profiles and deleting it and starting fresh seems to solve the problem a bit and then it reoccurs after a while.

 

 

The error occurs on the second from last line.

 

'CONSTRUCTORS
'----------------------------------------------
Option Explicit

Dim objNetwork, objSysInfo, strUserDN
Dim objGroupList, objUser, objFSO
Dim strComputerDN, objComputer
Dim WshNetwork
Dim UserName
Dim ComputerName


set Wshnetwork = CreateObject("WScript.Network")

Set objNetwork = CreateObject("Wscript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objSysInfo = CreateObject("ADSystemInfo")


strUserDN = objSysInfo.userName


'ERROR HERE LINE 44 BELOW!!>>>>>>>>>>>>>>>>>>
strComputerDN = objSysInfo.computerName

Set WshNetwork = WScript.CreateObject("WScript.Network") 

etc...

 

Any help greatly appreciated! Thanks

Posted
What about:

 

Set WshNetwork = WScript.CreateObject("WScript.Network")

strComputer = WshNetwork.ComputerName

strUser = WshNetwork.UserName

 

Would these replace the main bulk of code...?

Posted
Would these replace the main bulk of code...?

 

Do you want the distinguished name for the computer and user, or just the short name?

 

The code you posted retrieves the dn and works fine for me. What error message do you get?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...