I have to convert this to Powershell:
On Error Resume Next
strComputer = "."
Set WshShell = CreateObject("WScript.Shell")
Set oEnv = WshShell.Environment("Process")
sScriptPath = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - (Len(WScript.ScriptName) + 1))
WshShell.run "MsiExec.exe /i " & Chr(34) & sScriptPath & "\Install.msi" & chr(34) & " Transforms=" & chr(34) & sScriptPath & "\Install.mst" & chr(34),0 , True
WScript.Quit(0)
What I know:
On Error Resume Next
is default in Powershell
Set WshShell = CreateObject("WScript.Shell")
is something like
$WshShell = New-Object -ComObject Wscript.Shell -Strict
Can I then do
$oEnv = $WshShell.Environment("Process")
What WScrip.ScriptFullName is the full path or the current script?
How do I call that WshShell.run command in Powershell?