Add-SCScriptCommand
Lägger till ett skriptkommando i en programprofil, programdistribution eller värdprofil.
Syntax
Add-SCScriptCommand
-ApplicationProfile <ApplicationProfile>
[-Executable <String>]
[-CommandParameters <String>]
[-ScriptCommandSetting <SCScriptCommandSetting>]
-ScriptType <ScriptCommandType>
[-TimeoutSeconds <Int32>]
[-StandardInput <String>]
[-LibraryResource <CustomResource>]
[-RunAsAccount <VMMCredential>]
[-VMMServer <ServerConnection>]
[-DeploymentOrder <Int32>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[<CommonParameters>]
Add-SCScriptCommand
-ApplicationDeployment <ApplicationDeployment>
[-Executable <String>]
[-CommandParameters <String>]
[-ScriptCommandSetting <SCScriptCommandSetting>]
-ScriptType <ScriptCommandType>
[-TimeoutSeconds <Int32>]
[-StandardInput <String>]
[-LibraryResource <CustomResource>]
[-RunAsAccount <VMMCredential>]
[-VMMServer <ServerConnection>]
[-DeploymentOrder <Int32>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[<CommonParameters>]
Add-SCScriptCommand
-PhysicalComputerProfile <PhysicalComputerProfile>
[-Executable <String>]
[-CommandParameters <String>]
[-ScriptCommandSetting <SCScriptCommandSetting>]
-ScriptType <ScriptCommandType>
[-TimeoutSeconds <Int32>]
[-StandardInput <String>]
[-LibraryResource <CustomResource>]
[-RunAsAccount <VMMCredential>]
[-VMMServer <ServerConnection>]
[-JobGroup <Guid>]
[-DeploymentOrder <Int32>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[<CommonParameters>]
Add-SCScriptCommand
[-Executable <String>]
[-CommandParameters <String>]
[-ScriptCommandSetting <SCScriptCommandSetting>]
-ScriptType <ScriptCommandType>
[-TimeoutSeconds <Int32>]
[-StandardInput <String>]
[-LibraryResource <CustomResource>]
[-RunAsAccount <VMMCredential>]
[-VMMServer <ServerConnection>]
[-JobGroup <Guid>]
[-DeploymentOrder <Int32>]
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[<CommonParameters>]
Description
Cmdleten Add-SCScriptCommand lägger till ett skriptkommando i en programprofil, programdistribution eller värdprofil. Med ett skriptkommando kan en administratör köra kod under distributions- och serviceåtgärder.
Exempel
Exempel 1: Lägg till ett skriptkommando i en programprofil
PS C:\> $AppProfile = Get-SCApplicationProfile -Name "SvcWebAppProfile01"
PS C:\> $ScriptSetting = New-SCScriptCommandSetting -WorkingDirectory "Working_Folder_01"
PS C:\> Add-SCScriptCommand -ApplicationProfile $AppProfile -Executable "Startup.ps1" -ScriptType "PreInstall" -ScriptCommandSetting $ScriptSetting -TimeoutSeconds 120
Det första kommandot hämtar programprofilobjektet med namnet SvcWebAppProfile01 och lagrar objektet i variabeln $AppProfile.
Det andra kommandot skapar ett skriptkommandoinställningsobjekt som anger arbetskatalogen till Nyttolast och lagrar sedan objektet i variabeln $ScriptSetting.
Det sista kommandot lägger till ett förinstallerat skriptkommando i programprofilen som lagras i $AppProfile.
Parametrar
-ApplicationDeployment
Anger ett programdistributionsobjekt.
Type: | ApplicationDeployment |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ApplicationProfile
Anger ett programprofilobjekt.
Type: | ApplicationProfile |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-CommandParameters
Anger parametrarna för ett skript eller körbart program.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DeploymentOrder
Anger i vilken ordning en datornivå, programvärd eller ett program distribueras.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Executable
Anger namnet på ett körbart program.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-JobGroup
Anger en identifierare för en serie kommandon som ska köras som en uppsättning precis innan det slutliga kommandot som innehåller samma jobbgruppsidentifierare körs.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-JobVariable
Anger att jobbstatus spåras och lagras i variabeln som heter av den här parametern.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-LibraryResource
Anger en resurs som lagras i VMM-biblioteket (Virtual Machine Manager).
Type: | CustomResource |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PhysicalComputerProfile
Anger en profil som används för att distribuera ett operativsystem till en dator.
Type: | PhysicalComputerProfile |
Aliases: | VMHostProfile |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PROTipID
Anger ID för tipset prestanda- och resursoptimering (PRO-tips) som utlöste den här åtgärden. Med den här parametern kan du granska PRO-tips.
Type: | Guid |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RunAsAccount
Anger ett Kör som-konto som innehåller autentiseringsuppgifter med behörighet att utföra den här åtgärden.
Type: | VMMCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RunAsynchronously
Anger att jobbet körs asynkront så att kontrollen återgår till kommandogränssnittet omedelbart.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ScriptCommandSetting
Anger ett skriptkommandoinställningsobjekt.
Type: | SCScriptCommandSetting |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ScriptType
Anger en skripttyp. De acceptabla värdena för den här parametern är:
- Förinstallera
- PostInstall
- SaveState
- RestoreState
- PreService
- PostService
- Förinstallera
- PostUninstall
- OrderedCommand
- BareMetalPostWinPERegistration
- OnProvisionFirst
- OnProvisionRest
- OnDeleteLast
- OnDeleteRest
- Installera
- BareMetalPostDeployment
Type: | ScriptCommandType |
Accepted values: | PreService, PostService, SaveState, RestoreState, PreInstall, PostInstall, PreUninstall, PostUninstall, OrderedCommand, BareMetalPostWinPERegistration, OnProvisionFirst, OnProvisionRest, OnDeleteLast, OnDeleteRest, Install, BareMetalPostConfiguration, BareMetalPostUnattend |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-StandardInput
Anger en sökväg till en fil som innehåller standardindatainformation som ska användas med skriptkommandot.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TimeoutSeconds
Anger hur lång tid i sekunder en process väntar innan tidsgränsen nås.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VMMServer
Anger ett VMM-serverobjekt (Virtual Machine Manager).
Type: | ServerConnection |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Utdata
ScriptCommand
Den här cmdleten returnerar ett ScriptCommand-objekt .