Invoke-SCScriptCommand

Invoke-SCScriptCommand

Runs a script command on the specified host.

構文

Parameter Set: VMHost
Invoke-SCScriptCommand -Executable <String> -VMHost <Host> [-CommandParameters <String> ] [-JobVariable <String> ] [-LibraryResource <CustomResource> ] [-PROTipID <Guid]> ] [-RunAsAccount <RunAsAccount> ] [-RunAsynchronously] [-ScriptCommandSetting <SCScriptCommandSetting> ] [-StandardInput <String> ] [-TimeoutSeconds <Int32> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

詳細説明

The Invoke-SCScriptCommand cmdlet runs a script command on the specified host. This cmdlet is only supported on Hyper-V hosts.

パラメーター

-CommandParameters<String>

Specifies the parameters for a script or executable program.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-Executable<String>

Specifies the name of an executable program.

エイリアス

none

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-LibraryResource<CustomResource>

Specifies a resource stored in the VMM library.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-PROTipID<Guid]>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-RunAsAccount<RunAsAccount>

Specifies a Run As account that contains credentials with permission to perform this action.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-ScriptCommandSetting<SCScriptCommandSetting>

Specifies a script command setting object.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-StandardInput<String>

Specifies a path to a file that contains standard input information to use with the script command.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-TimeoutSeconds<Int32>

Specifies the amount of time, in seconds, that a process waits before timing out.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-VMHost<Host>

Specifies a virtual machine host object. VMM supports Hyper-V hosts, VMware ESX hosts, and Citrix XenServer hosts.

For more information about each type of host, type Get-Help Add-SCVMHost -detailed. See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

エイリアス

none

必須?

true

位置は?

named

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

  • ScriptCommand

  • Requires a VMHost object, which can be retrieved by using the Get-SCVMHost cmdlet.

Example Example 1.: Run a script command.:

The first command gets the host object named VMHost01, and then stores the object in the $VMHost variable.

The second command runs the executable program named Cmd.exe with the specified parameters on the host stored in $VMHost. In this case, Invoke-SCScriptCommand removes the test directory from the C:\ drive on VMHost01.

PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01"
PS C:\> Invoke-SCScriptCommand -VMHost $VMHost -Executable "Cmd.exe" -CommandParameters "/C rd C:\Test" -TimeoutSeconds 60

関連トピック

Add-SCScriptCommand

Add-SCVMHost

Get-SCScriptCommand

Get-SCScriptCommandSetting

Get-SCVMHost

New-SCScriptCommandSetting

Remove-SCScriptCommand

Set-SCScriptCommand