我正在尝试创建脚本,我可以使用Powershell
脚本同时访问Linux和Unix,但是每当我运行脚本时它都会遇到问题它打开Unix窗口但是在Unix存在之后会话。我能够访问窗口会话。我不想退出Unix会话。我想两者都用。请指教。以下是我的代码
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
$prompt = new-object -comobject wscript.shell
$getPasswordAIX = Get-Credential -UserName "Avni" -Message "Enter password"
$passwordAIX = $getPasswordAIX.GetNetworkCredential().password
$userAIX = $getPasswordAIX.GetNetworkCredential().username
#.\plink.exe mlismbc014 -i H:\davinsi.ppk -l $userAIX -pw $passwordAIX
.\plink.exe mlismbc014 -i H:\Key\unixKeys\avni.ppk -l $userAIX -pw $passwordAIX
echo %errorlevel%
Write-Host "Press any key to continue ..."
$anyKey = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
$pshost = Get-Host # Get the PowerShell Host.
$pswindow = $pshost.UI.RawUI # Get the PowerShell Host's UI.
$newsize = $pswindow.BufferSize # Get the UI's current Buffer Size.
$newsize.width = 150 # Set the new buffer's width to 150 columns.
$pswindow.buffersize = $newsize # Set the new Buffer Size as active.
$newsize = $pswindow.windowsize # Get the UI's current Window Size.
$newsize.width = 150 # Set the new Window Width to 150 columns.
$pswindow.windowsize = $newsize # Set the new Window Size as active.
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
$prompt = new-object -comobject wscript.shell