Jump to content

Featured Replies

Posted

Hi Guys,

 

 

I have a issue with a script i have put together from watching multiple YouTube videos,

 

and it works but i want the input box to be masked with *'s and have read up how to do it,

 

but as a newbie i don't understand and as you can guess i cant get it to work,

 

 

Also i don't think i have added this in the correct area, sorry

 

 

Here is the website link i had a look at : http://www.edugeek.net/forums/coding/6951-masking-password-inputbox-vbscript.html

 

 

Here is the script as follows :

 

password = "PASSWORDHERE"

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("Please enter your password","Password", "", "*") - I think this is the problem can you tell me what im doing wrong

Select case returnvalue

Case Password

MsgBox "Welcome Louis"

 

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 "Wrong password. Now loging off.",0,"Wrong Password"

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

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...