0

I am trying to run the following command on one of my servers.

$dotnetFrameworkInstalled =  psexec -accepteula \\server1 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' 'Import-Module ServerManager; 
$feature = Get-WindowsFeature -ErrorAction Stop | Where-Object {  $_.Name -eq ''NET-Framework'' };   
Write-Output $feature.Installed'

It looks like this is getting stuck after showing the following in the output window.

psexec : 
At C:\temp\Untitled1.ps1:2 char:30
+ $dotnetFrameworkInstalled =  psexec -accepteula \\server1 'C:\Windows\Syst ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

But the same command is working with another server (server2).

x1877
  • 3
  • 3
  • A formatting tip: since the `;` is a statement separator in Powershell, you can add those on new lines and make your code a little easier to follow in the question body. Content following a pipe `|` is also very readable to place on a new line. – Anthony Neace Sep 22 '13 at 00:11

1 Answers1

0

what is psexec ? I think just some argument parse issue. please turn to use Start-Process Start-Process -FilePath "psexec" -ArgumentList "-accepteula ...."

Mosser Lee
  • 48
  • 1
  • 8
  • Thanks for your response. PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. For more details o psexec - http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx. – x1877 Sep 22 '13 at 23:38