Write-Output " Creating a new PowerShell Session"
$arg = {"$Host.UI.RawUI.WindowTitle='MySession'";"&'F:\Scripts\LicMgmt .ps1'";}
$StartInfo = new-object System.Diagnostics.ProcessStartInfo
$StartInfo.FileName = "$pshome\powershell.exe"
$StartInfo.Arguments = $arg
[System.Diagnostics.Process]::Start($StartInfo)
To Check your Open Session/Kill It
Get-Process|where-object{($_.MainWindowTitle) -match '^(Select MySession|MySession)'}|Stop-Process
No comments:
Post a Comment