What about:
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputer = WshNetwork.ComputerName
strUser = WshNetwork.UserName
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.
etc...Code:'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")
Any help greatly appreciated! Thanks
What about:
Set WshNetwork = WScript.CreateObject("WScript.Network")
strComputer = WshNetwork.ComputerName
strUser = WshNetwork.UserName
Googled for AdSystemInfo and Vista...
ADSystemInfo causes logon script to hang in Vista
There are currently 1 users browsing this thread. (0 members and 1 guests)