Sdílet prostřednictvím


Update-SCSMClassInstance

Aktualizace hodnoty vlastností instance třídy.

Syntax

Update-SCSMClassInstance
      [-Instance] <EnterpriseManagementInstance[]>
      [-PassThru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Rutina Update-SCSMClassInstance aktualizuje hodnoty vlastností instance třídy.

Příklady

Příklad 1: Označení instancí třídy k odstranění

PS C:\>Get-SCSMClassInstance (Get-SCSMClass -Name "System.Printer") | % { $_.ObjectStatus = "pending delete"; $_ } | Update-SCSMClassinstance

Tento příkaz aktualizuje všechny instance položek konfigurace třídy System.Printer a označí je k odstranění.

Příklad 2: Změna hodnoty umístění instance položky konfigurace Service Manager

PS C:\>Get-SCSMClassInstance -Class (Get-SCSMClass -Name "Microsoft.Ad.Printer") -Filter 'Location -eq "Seattle"' | Format-Table UNCName,PrinterName,Description,Location
UNCName                PrinterName Description Location
-------                ----------- ----------- --------
\\PrintServer\Printer4 Printer4                Seattle
\\PrintServer\Printer7 Printer7                Seattle
\\PrintServer\Printer1 Printer1                Seattle
\\PrintServer\Printer9 Printer9                Seattle
\\PrintServer\Printer6 Printer6                Seattle
\\PrintServer\Printer3 Printer3                Seattle
\\PrintServer\Printer2 Printer2                Seattle
\\PrintServer\Printer5 Printer5                Seattle
\\PrintServer\Printer0 Printer0                Seattle
\\PrintServer\Printer8 Printer8                Seattle


PS C:\>Get-SCSMClassInstance -Class (Get-SCSMClass -Name "Microsoft.Ad.Printer") -Filter 'Location -eq "Seattle"'| % { $_.Location = "Portland"; $_ } | Update-SCSMClassInstance
PS C:\>Get-SCSMClassInstance -Class (Get-SCSMClass -Name "Microsoft.Ad.Printer") -Filter 'Location -eq "Portland"' | Format-Table UNCName,PrinterName,Description,Location
UNCName                PrinterName Description Location
-------                ----------- ----------- --------
\\PrintServer\Printer4 Printer4                Portland
\\PrintServer\Printer7 Printer7                Portland
\\PrintServer\Printer1 Printer1                Portland
\\PrintServer\Printer9 Printer9                Portland
\\PrintServer\Printer6 Printer6                Portland
\\PrintServer\Printer3 Printer3                Portland
\\PrintServer\Printer2 Printer2                Portland
\\PrintServer\Printer5 Printer5                Portland
\\PrintServer\Printer0 Printer0                Portland
\\PrintServer\Printer8 Printer8                Portland

Tento příkaz změní hodnotu umístění instance položky konfigurace Service Manager.

Parametry

-Confirm

Před spuštěním rutiny zobrazí výzvu k potvrzení.

Type:System.Management.Automation.SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Instance

Určuje instanci třídy, která se má aktualizovat.

Type:Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

Označuje, že instance třídy se vrátí do aktuální relace Windows PowerShell po dokončení aktualizace. Tento výstupní objekt se pak dá předat jiným rutinám.

Type:System.Management.Automation.SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Zobrazuje, co by se stalo při spuštění rutiny. Rutina není spuštěna.

Type:SwitchParameterSystem.Management.Automation.SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Vstupy

Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance

Instanci třídy můžete řadit do parametru Instancerutiny Update-SCSMClassInstance .

Výstupy

EnterpriseManagementInstance

Tato rutina generuje objekt EnterpriseManagementInstance při použití parametru PassThru .