Trying to execute:
Set objWshShell = CreateObject("WScript.Shell")
Getting error:
[![PS C:\Windows\system32> Set objWshShell = WScript.CreateObject("WScript.Shell")
Set-Variable : A positional parameter cannot be found that accepts argument
'WScript.CreateObject'.
At line:1 char:1
+ Set objWshShell = WScript.CreateObject("WScript.Shell")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) \[Set-Variable\], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetVaria
bleCommand][1]][1]
This however works:
$WSH = New-Object -Com WScript.Shell
$WSH.Run("explorer.exe""")
I am trying to run this which requires the shell and context of it :
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """%PROGRAMFILES(x86)%\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe"""
WScript.Sleep 3000
WshShell.AppActivate "Cisco AnyConnect Secure Mobility Client"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 5000
WshShell.SendKeys "PASSWORD"
WshShell.SendKeys "{ENTER}"