Windows PowerShell version 3.0 doesn't support installation of an exe

خرید بک لینک

I am trying to install an exe using C# code (.net framework 4.5) and PowerShell script in remote machine. The remote machine's OS is Windows 7 and its PowerShell version is 3. The exe has been moved to the location in the remote machine but it's not getting installed. But the same when I tried to install in remote machine which has Windows 8.1 OS and PowerShell version 4 it's getting installed correctly. I have mentioned the code used below: Scrip am using to install exe in remote using session.

$session = New-PSSession -ComputerName $remoteip -Credential $cred -ConfigurationName $configurationName $contents = IO.File::ReadAllBytes($localpath) Invoke-Command -session $session -ScriptBlock{ $now = Get-Date -format "dd-MMM-yyyy-HH-mm-ss" $outfilename = $env:temp + "" + $now + "xxx.exe" start-process -FilePath $outfilename '/Install silent' -verb runAs -Wait } I have given these commands for enabling remote session * Enable-PSRemoting -SkipNetworkProfileCheck –Force * Set-Item wsman:localhostclienttrustedhosts * By using Pipeline in c# I have invoked the script.

var scriptPath = "C:scriptpath.ps1"; var runspaceConfiguration = RunspaceConfiguration.Create(); var runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration); runspace.Open(); var scriptInvoker = new RunspaceInvoke(runspace); scriptInvoker.Invoke("Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned"); var pipeline = runspace.CreatePipeline(); var myCommand = new Command(scriptPath); pipeline.Commands.Add(myCommand); pipeline.Invoke(); I dont get any errors. Exe has been moved to the location.But its not getting installed in Windows 7 OS.

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 223 تاريخ: يکشنبه 30 خرداد 1395 ساعت: 11:56

صفحه بندی