Unable to use invoke-command

Welcome Forums General PowerShell Q&A Unable to use invoke-command

This topic contains 2 replies, has 3 voices, and was last updated by

11 months, 1 week ago.

  • Author
  • #102650

    Topics: 6
    Replies: 8
    Points: 2
    Rank: Member

    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:\>. Please help me running this command or let me know if you need any information my side.

  • #102655

    Topics: 2
    Replies: 929
    Points: 1,594
    Helping Hand
    Rank: Community Hero
    Get-Help -Name Invoke-Command -Examples
        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}
  • #102683

    Topics: 33
    Replies: 128
    Points: 305
    Helping Hand
    Rank: Contributor

    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 { 

The topic ‘Unable to use invoke-command’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort