Examples of using Invoke-command in English and their translations into German
{-}
-
Colloquial
-
Official
-
Ecclesiastic
-
Medicine
-
Financial
-
Ecclesiastic
-
Political
-
Computer
-
Programming
-
Official/political
-
Political
Or Invoke-Command cmdlets to connect remotely.
The following command uses the AsJob parameter of Invoke-Command to start.
The Invoke-Command command is considered to be complete when.
Runs commands on local and remote computers. Invoke-Command.
For more information about the Invoke-Command cmdlet, see Invoke-Command.
To run any command on one or many remote computers, use the Invoke-Command cmdlet.
STEP 2: INVOKE-COMMAND GET-JOB To manage a remote background job, use the Job cmdlets.
Errors that result from the command that Invoke-Command runs are included in the command results.
Invoke-command-computername S1, S2, S3-scriptblock{get-culture} You can also run a command in multiple PSSessions.
Ps1 script from the Server01 remote computer to the local computer: invoke-command-computername Server01'{get-content c:\ps-test\test. ps1} set-location c:\ps-test\test.
STEP 1: INVOKE-COMMAND START-JOB Use the Invoke-Command cmdlet to run a Start-Job command on a remote computer.
As a result, if the remote computer specified by the ConnectionURI parameter returns a redirection message, Windows PowerShell will redirect the connection, but if the new destinationreturns another redirection message, the redirection count value of 1 is exceeded, and Invoke-Command returns a non-terminating error.
The first command uses the Invoke-Command cmdlet to start a background job that runs a Get-Service command on three remote computers.
Invoke-command-computername Server01-scriptblock{get-eventlog system}-asjob The results of the command resemble the following sample output.
Because the job was started by using the AsJob parameter of Invoke-Command, the job object is located on the local computer, even though the job runs on the remote computer.
Invoke-command-session$s-scriptblock{$p get-process} Because the PSSession uses a persistent connection, you can run another command in the same PSSession that uses the$p variable.
C:\PS>$s new-pssession-computername server02-credential domain01\user01 C:\PS> invoke-command-session$s-scriptblock{get-culture} This example runs the same"Get-Culture" command in a session(a persistent connection) on the Server02 remote computer.
Invoke-command-computername Server01-scriptblock{get-culture} The ComputerName parameter is designed for situation in which you run a single command or several unrelated commands on one or many computers.
You can use the variable with a cmdlet such as Invoke-Command, as shown in the following example: C:\PS> invoke-command-scriptblock$a-args"Other value" Other value assigned.
C:\PS> invoke-command-ComputerName S1, S2, S3-scriptblock{get-culture} out-gridview This example shows the correct format for sending data collected from remote computers to the Out-GridView cmdlet.
The following example uses the Args parameter of the Invoke-Command cmdlet to assign a different value to the parameter: C:\PS> invoke-command-scriptblock{param($uu"Parameter"); "$uu assigned.
When using the Invoke-Command cmdlet to run a Get-PfxCertificate command remotely, and the. pfx certificate file is not password protected, the value of the Authentication parameter of Invoke-Command must be"CredSSP.
S new-pssession-computername S1, S2, S3 invoke-command-session$s -scriptblock{get-culture} To include the local computer list of computers, type the name of the local computer, type a dot.
C:\PS> invoke-command-computername Server01-scriptblock{get-executionpolicy} set-executionpolicy-force This command gets the execution policy from a remote computer and applies that execution policy to the local computer.
The fourth command uses Invoke-Command to run a Receive-Job command in each of the PSSessions in$s and save the results in the$results variable.
C:\PS>$j invoke-command-computername Server01-scriptblock{get-process}-asJob C:\PS>$j remove-job This example shows how to use the Remove-Job cmdlet to remove a job that was started on a remote computer by using the AsJob parameter of the Invoke-Command cmdlet.
When you use the AsJob parameter of Invoke-Command to start a job on one or more computers, the job consists of an executive parent job and a child job for each job run on each computer.