Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

OpenDSObject 10 second wait for validation of user credentials

$
0
0

Hello,

I'm trying to validate user credentials locally, not on a domain, on a PC running Windows 7 Pro x64 (fully patched).

The following code works, but it takes 10 seconds to see the MsgBox. (The same wait was confirmed in a Windows 7 Home Premium x64 VM. In a Windows XP Pro SP3 VM, the same code takes less than a second to run.) What's the reason for the wait under Windows 7? Can it be avoided?

regards, AndyA

Dim oIADS
Dim oNetWk : Set oNetwk = CreateObject("WScript.Network")
Dim strAdminUserName : strAdminUserName = "admin_name_here"
Dim strAdminPassword : strAdminPassword = "admin_pw_here"
Dim intErrNum

Const ADS_SECURE_AUTHENTICATION = 1

On Error Resume Next

 Set oIADS = GetObject("WinNT:").OpenDSObject("WinNT://" &_
  oNetWk.ComputerName & "/" &_
  strAdminUserName & ",user", strAdminUserName, strAdminPassword, _
  ADS_SECURE_AUTHENTICATION)

 intErrNum = Err.Number

On Error Goto 0

If intErrNum = 0 then
 MsgBox "The credentials are OK"
Else
 MsgBox "The credentials are bad; the error number is: " & intErrNum
End If




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>