# Unable to use invoke-command

**URL:** <https://forums.powershell.org/t/unable-to-use-invoke-command/10828>\
**Category:** PowerShell Help\
**Created:** [June 17, 2018, 1:24pm UTC](https://forums.powershell.org/t/unable-to-use-invoke-command/10828 "2018-06-17T13:24:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jps0319](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jps0319/32/325_2.png) [@jps0319](https://forums.powershell.org/u/jps0319)\
**Post date:** [June 17, 2018, 1:24pm UTC](https://forums.powershell.org/t/unable-to-use-invoke-command/10828/1 "2018-06-17T13:24:55Z")

</div>

Hi All,

I need to install a software on multiple computers. The setup file is residing on one of the jump box. Below is the switch to install the software locally, I tried this below command locally on server and it works:

\\SCCMSources\Applications\CrowdStrike\CrowdStrike\_3.1.5226.0\WindowsSensor.exe /install /quiet /norestart CID=000000000000000000000-00

I want to use this command in invoke-command. I tried below command on localhost and on remote computer. It does not give any error message but does not do anything also.

Invoke-Command -ScriptBlock {c:\temp\CrowdStrike\_3.1.5226.0\WindowsSensor.exe /install /quiet /norestart CID=000000000000000000000-00} -ComputerName localhost

It just do nothing, once I press enter, it goes to c:&gt;. Please help me running this command or let me know if you need any information my side.

---

<div class="post-metadata">

**Author:** ![postanote](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@postanote](https://forums.powershell.org/u/postanote)\
**Post date:** [June 17, 2018, 4:35pm UTC](https://forums.powershell.org/t/unable-to-use-invoke-command/10828/2 "2018-06-17T16:35:06Z")

</div>

```
Get-Help -Name Invoke-Command -Examples

NAME
    Invoke-Command
    
SYNOPSIS **Runs commands on local and remote computers.** Example 1: Run a script on a server
    Invoke-Command -FilePath c:\scripts\test.ps1 -ComputerName Server01 **Example 2: Run a command on a remote server** _Invoke-Command -ComputerName server01 -Credential domain01\user01 -ScriptBlock {Get-Culture} …_
```

---

<div class="post-metadata">

**Author:** ![firmbyte](https://avatars.discourse-cdn.com/v4/letter/f/e68b1a/32.png) [@firmbyte](https://forums.powershell.org/u/firmbyte)\
**Post date:** [June 18, 2018, 6:25am UTC](https://forums.powershell.org/t/unable-to-use-invoke-command/10828/3 "2018-06-18T06:25:22Z")

</div>

In some cases, when running commends on servers, I’ve to build up the command line, like this:

```
$robocopyOptions = @('/E','/ZB','/J','/EFSRAW','/COPYALL','/XO','/R:3','/W:60','/NP','/xf','log*')
$robocopyOptions += "/LOG:$($log)"
$robocopyOptions += "/xf LOG* "

$CmdLine = @($source, $destination) + $robocopyOptions
& 'robocopy.exe' $CmdLine
```

In some cases when running commands on remote servers I use a PSSession, like this:

```
$pss = New-PSSession $Server -Credential (Import-Clixml "$codedeploy") 
Invoke-Command -Session $pss -scriptblock {_yoursrcipt_}
```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/unable-to-use-invoke-command/10828/4 "2024-05-16T20:34:54Z")

</div>


