johnmahugu

javascript - bypass smartcard windows logon

Jun 24th, 2015
362
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. ‘Changes registry key on remote computer to allow logon without CAC card ‘ ‘Jason Hofferle
  8. 21 June 2007
  9. ‘ ‘****************************************************************************** Option Explicit Const HKEY_LOCAL_MACHINE = &H80000002 Dim objReg, strComputer
  10. strComputer = InputBox(“Computer Name or IP Address”)
  11. On Error Resume Next
  12. Set objReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & strComputer & “\root\default:StdRegProv”)
  13. objReg.SetDwordValue HKEY_LOCAL_MACHINE, “SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system”, “scforceoption”, 0
  14. If Err <> 0 Then
  15. WScript.Echo “Error changing registry key on ” & strComputer
  16. Else
  17. WScript.Echo “Registry Key changed on ” & strComputer
  18. End if
  19. Set objReg = Nothing
  20. 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.
  21.  
  22. 1. Login to the source machine.
  23. 2. Go to RUN and type ‘REGEDIT’. Press Enter
  24. 3. This will launch the Registry Editor utility
  25. 4. Now go to File menu and click on ‘Connect Network Registry’, as seen in the below picture
  26.  
  27. 5. Type in the name of the target computer in the pop up window and press OK
  28.  
  29. 6. If Target computer is not completely out of network, the Registry settings will be loaded
  30. 7. Now, you can use the Registry of remote computer to diagnose and troubleshoot the issue
  31. 8. Make sure that you have taken a backup of Registry settings before editing
  32. 9. Follow the registry path below
  33.  
  34. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system
  35. 10. Look for the registry key scforceoption
  36. 11. Change its value to 0
Advertisement
Add Comment
Please, Sign In to add comment