Hey guys, first time poster.
I'm trying to create a script that I can put in my startup folder so whenever I login to Windows explorer.exe is closed until a password is entered and if entered incorrectly, you're logged out. Essentially I'm having trouble with the Inputbox code, I want my password to be masked with an asterisks or bullet point as it usually is when you enter your password on an online site.
Line 18 is where I'm having trouble, I'm not sure what code to enter.
Thanks in advance guyz.
I'm trying to create a script that I can put in my startup folder so whenever I login to Windows explorer.exe is closed until a password is entered and if entered incorrectly, you're logged out. Essentially I'm having trouble with the Inputbox code, I want my password to be masked with an asterisks or bullet point as it usually is when you enter your password on an online site.
Code:
password = "PasswordExample"
strComputer = "."
strExe = "taskkill /F /IM explorer.exe"
' Connect to WMI
set objWMIService = getobject("winmgmts://"_
& strComputer & "/root/cimv2")
' Obtain the Win32_Process class of object.
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
'Execute the program now at the command line.
Set strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
Do
returnvalue = InputBox ( "Welcome back, John","Please enter your password:")
Select case returnvalue
Case Password
MsgBox "Password Accepted"
strComputer = "."
strExe = "explorer.exe"
' Connect to WMI
set objWMIService = getobject("winmgmts://"_
& strComputer & "/root/cimv2")
' Obtain the Win32_Process class of object.
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
'Execute the program now at the command line.
Set strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
Exit Do
Case Else
MsgBox "Error",0,"Oops"
strComputer = "."
strExe = "shutdown.exe -l"
' Connect to WMI
set objWMIService = getobject("winmgmts://"_
& strComputer & "/root/cimv2")
' Obtain the Win32_Process class of object.
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
'Execute the program now at the command line.
Set strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
WScript.echo "Created: " & strExe & " on " & strComputer
WSCript.Quit
End select
Loop
Line 18 is where I'm having trouble, I'm not sure what code to enter.
Thanks in advance guyz.