Install Application Under Restricted User – with 3 possible passwords

‘ —– ExeScript Options Begin —–
‘ ScriptType: window,silent,activescript,invoker
‘ DestDirectory: %temp%
‘ Icon: C:\Windows\System32\shell32.dll,162
‘ File: I:\temp\_LDClient\cpau.exe
‘ File: I:\temp\_LDClient\YourProgramHere.exe
‘ File: I:\temp\_LDClient\progress.gif
‘ File: I:\temp\_LDClient\progressbar.hta
‘ OutputFile: I:\temp\_LDClient\Automated_Name_of_Program_Here.exe
‘ Comments: Created by Eddie Jackson
‘ CompanyName: YourCompanyHere
‘ FileDescription: Automated LANDesk Client
‘ FileVersion: 9.50.0.530
‘ LegalCopyright: YourCompanyHere
‘ ProductName: Automated LANDesk Client
‘ ProductVersion: 9.50.0.530
‘ —– ExeScript Options End —–
On error resume next

”””””””””””””””””””””””””””
‘Author
‘Eddie Jackson

‘Created
’02/13/2014

‘Modified


‘Purpose
‘Installs Apps for restricted users
‘Cycles through a list of specified passwords

‘Note
‘This file must be compiled
”””””””””””””””””””””””””””

Set filesys = CreateObject(“Scripting.FileSystemObject”)
Set objShell = CreateObject(“Wscript.Shell”)

‘SET LOCAL TEMP DIRECTORY
LocalTemp = CreateObject(“WScript.Shell”).ExpandEnvironmentStrings(“%Temp%”)

AppName = “YourProgramHere.exe”

‘CORPORATE PASSWORD 1
Password1 = “PutPassword1Here”

‘CORPORATE PASSWORD 2
Password2 = “PutPassword2Here”

‘CORPORATE PASSWORD 3
Password3 = “PutPassword3Here”

objShell.Run “taskkill.exe /f /im mshta.exe”,0,true

If filesys.FileExists(LocalTemp & “\CPAU.exe”) then
objShell.Run “C:\Windows\System32\mshta.exe” & ” ” & LocalTemp & “\progressbar.hta”,9,false

on error resume next
‘msgbox “Trying password 1”
Err.Number = objShell.Run (LocalTemp & “\CPAU.exe -u %computername%\administrator -p ” & Password1 & ” -ex ” & chr(34) & LocalTemp & “\” & AppName & chr(34) & ” -LWoP -hide -wait”,0,true)

if Err.Number <> 0 then
on error resume next
‘msgbox “Trying password 2”
Err.Number = objShell.Run (LocalTemp & “\CPAU.exe -u %computername%\administrator -p ” & Password2 & ” -ex ” & chr(34) & LocalTemp & “\” & AppName & chr(34) & ” -LWoP -hide -wait”,0,true)
end if

if Err.Number <> 0 then
on error resume next
‘msgbox “Trying password 3”
Err.Number = objShell.Run (LocalTemp & “\CPAU.exe -u %computername%\administrator -p ” & Password3 & ” -ex ” & chr(34) & LocalTemp & “\” & AppName & chr(34) & ” -LWoP -hide -wait”,0,true)
end if

end if

objShell.Run “taskkill.exe /f /im mshta.exe”,0,false

WScript.Quit(0)

email me