johnmahugu

javascript - bypass smartcard windows logon

Jun 24th, 2015
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. This VBscript prompts for a computer name or IP Address, connects to that system’s registry over the network and changes the scforceoption key to allow for immediate logon without a smart card.
  2.  
  3. Many organizations now require CAC cards or another type of smart card to logon to workstations. A common way to enforce this is to use the Interactive logon: Require smart card group policy setting. When there is a problem with smart card authentication, this setting makes it difficult for troubleshooting.
  4.  
  5. ‘******************************************************************************
  6. ‘cac_bypass.vbs
  7. ‘
  8. ‘Changes registry key on remote computer to allow logon without CAC card ‘ ‘Jason Hofferle
  9. ’21 June 2007
  10. ‘ ‘****************************************************************************** Option Explicit Const HKEY_LOCAL_MACHINE = &H80000002 Dim objReg, strComputer
  11. strComputer = InputBox(“Computer Name or IP Address”)
  12. On Error Resume Next
  13. Set objReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & strComputer & “\root\default:StdRegProv”)
  14. objReg.SetDwordValue HKEY_LOCAL_MACHINE, “SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system”, “scforceoption”, 0
  15. If Err <> 0 Then
  16. WScript.Echo “Error changing registry key on ” & strComputer
  17. Else
  18. WScript.Echo “Registry Key changed on ” & strComputer
  19. End if
  20. Set objReg = Nothing
  21. If you are not familiar with power shell and VB Script, then you could use a computer with the same administrator account setup (same user name and password) to remotely access your computer registry.
  22.  
  23. 1. Login to the source machine.
  24. 2. Go to RUN and type ‘REGEDIT’. Press Enter
  25. 3. This will launch the Registry Editor utility
  26. 4. Now go to File menu and click on ‘Connect Network Registry’, as seen in the below picture
  27.  
  28. 5. Type in the name of the target computer in the pop up window and press OK
  29.  
  30. 6. If Target computer is not completely out of network, the Registry settings will be loaded
  31. 7. Now, you can use the Registry of remote computer to diagnose and troubleshoot the issue
  32. 8. Make sure that you have taken a backup of Registry settings before editing
  33. 9. Follow the registry path below
  34.  
  35. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system
  36. 10. Look for the registry key scforceoption
  37. 11. Change its value to 0
Advertisement
Add Comment
Please, Sign In to add comment