0% found this document useful (0 votes)
2 views2 pages

Old

The document is a script that implements a password protection mechanism using Internet Explorer and PowerShell. It prompts the user to enter a password or emergency code, allowing up to three attempts before locking the workstation. If the correct credentials are not entered, a countdown is displayed before the PC is automatically locked.

Uploaded by

nicholaschuah.yh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Old

The document is a script that implements a password protection mechanism using Internet Explorer and PowerShell. It prompts the user to enter a password or emergency code, allowing up to three attempts before locking the workstation. If the correct credentials are not entered, a countdown is displayed before the PC is automatically locked.

Uploaded by

nicholaschuah.yh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

old

Dim password, emergencyCode, attempts


password = "001376"
emergencyCode = "000000"
attempts = 0

' Create a blank IE window as a background


Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "about:blank"
IE.ToolBar = 0
IE.StatusBar = 0
IE.Width = 1920 ' Set the width to cover the entire screen
IE.Height = 1040 ' Set the height to leave space for the taskbar
IE.Left = 0
IE.Top = 0
IE.Visible = True
IE.FullScreen = True

' Start PowerShell script to monitor for Ctrl+X


Set objShell = CreateObject("WScript.Shell")
objShell.Run "powershell.exe -NoProfile -ExecutionPolicy Bypass -File monitor.ps1",
0, False

Do While attempts < 3


Dim userInput
userInput = InputBox("Due to an unexpected error, you are required to enter the
password here. The password might now be the same as the lock screen! Please enter
the password here: ", "Windows Lock Screen v2.1")
If userInput = password Or userInput = emergencyCode Then
MsgBox "The password that you've entered is valid. Please continue.",
vbInformation, "Windows Lock Screen - Successfully entered password!"
IE.Quit
Exit Do
Else
attempts = attempts + 1
If attempts < 3 Then
MsgBox "The password that you've entered is invalid. Please try again!
You have " & (3 - attempts) & " attempts left!", vbCritical, "Windows Lock Screen -
Failed to enter correct password!"
End If
End If
Loop

If attempts = 3 Then
MsgBox "The password that you've entered is invalid. You failed! Your PC will
be automatically locked in 20 second(s)!", vbCritical, "Windows Lock Screen -
Failed to enter correct password!"
Dim countdown
countdown = 20
Do While countdown > 0
CreateObject("WScript.Shell").Popup "Your PC will be automatically locked
in " & countdown & " second(s)!", 1, "Windows Lock Screen - Countdown"
WScript.Sleep 1000
countdown = countdown - 1
Loop
CreateObject("WScript.Shell").Run "rundll32.exe user32.dll LockWorkStation", 0,
True
IE.Quit
End If

You might also like