Export (0) Print
Expand All
Expand Minimize

Set-SCScript

Updated: April 29, 2014

Applies To: System Center 2012 R2 Virtual Machine Manager

Set-SCScript

Changes the properties of a script stored in the VMM library.

Syntax

Parameter Set: Default
Set-SCScript [-Script] <Script> [-Description <String> ] [-Enabled <Boolean> ] [-FamilyName <String> ] [-JobVariable <String> ] [-Name <String> ] [-Owner <String> ] [-PROTipID <Guid> ] [-Release <String> ] [-RunAsynchronously] [-SharePath <String> ] [-UserRole <UserRole> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: EquivalencySet
Set-SCScript [-Scripts] <List<Script>> -FamilyName <String> -Release <String> [-JobVariable <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]




Detailed Description

The Set-SCScript cmdlet changes one or more properties of a script stored in the Virtual Machine Manager (VMM) library.

Properties that you can change include:

-- Description
-- Enabled
-- Name
-- Owner
-- SharePath

Script objects represent script files stored in a library share on a library server. Typically, these scripts are either Windows PowerShell scripts or answer files, such as a Sysprep.inf or an Unattend.xml file, that contain the inputs required for the Windows Setup program.

Parameters

-Description<String>

States a description for the specified object.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Enabled<Boolean>

Enables an object when set to $True, or disables an object when set to $False. For example, if you want to upgrade software on a virtual machine template, you can disable the template object in the VMM library to temporarily prevent users from using that object.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FamilyName<String>

Specifies a family name for a physical resource in the VMM library. This value is used in conjunction with Release, Namespace, and Type to establish equivalency among library resources.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of a VMM object.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Owner<String>

Specifies the owner of a VMM object in the form of a valid domain user account.

Example format: -Owner "Contoso\ReneeLo"

Example format: -Owner "ReneeLo@Contoso"


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid>

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Release<String>

Specifies a string that describes the release of a library resource. VMM automatically creates a release value for every resource imported into the library. After the resource has been imported, the string can be customized.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Script<Script>

Specifies a VMM script object.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-Scripts<List<Script>>

Specifies an array of script objects.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-SharePath<String>

Specifies a path to a valid library share on an existing library server that uses a Universal Naming Convention (UNC) path.

Example format: -SharePath "\\LibServer01\LibShare"


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UserRole<UserRole>

Specifies a user role object.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Script

Notes

  • This cmdlet requires a VMM script object, which can be retrieved by using the Get-SCScript cmdlet.

Examples

Example 1: Change the description of a script

The first command retrieves the answer file script object named Sysprep.inf from the library on VMMServer01, and then stores the object in the $Script variable.

The second command changes the description of this script object to Windows Server 2008 R2 Sysprep Answer File.


PS C:\> $Script = Get-SCScript -VMMServer "VMMServer01.Contoso.com" | where { $_.LibraryServer.Name -eq "LibraryServer01.Contoso.com" -and $_.Name -eq "Sysprep.inf" }
PS C:\> Set-SCScript -Script $Script -Description "Windows Server 2008 R2 Sysprep Answer File"

Example 2: Disable a Windows PowerShell script stored in the VMM library

The first command gets the Windows PowerShell script object named AddHost.ps1, and then stores the object in the $Script variable.

The second command disables the script stored in $Script.


PS C:\> $Script = Get-SCScript -VMMServer "VMMServer01.Contoso.com" | where { $_.LibraryServer.Name -eq "LibraryServer01.Contoso.com" -and $_.Name -eq "AddHost.ps1" }
PS C:\> Set-SCScript -Script $Script -Enabled $False

Example 3: Specify an owner for all scripts with an Unknown owner

This command gets all script objects from the VMM library whose owner is Unknown, and then specifies an owner for each script object.


PS C:\> Get-SCScript -VMMServer "VMMServer01.Contoso.com" | where {$_.Owner -eq "Unknown"} | Set-SCScript -Owner "Contoso\ReneeLo"

Related topics

 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft