Udostępnij przez


Update-SCClassInstance

Aktualizuje wartości właściwości instancji klasy.

Składnia

Default (Domyślna)

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

Opis

Polecenie cmdlet Update-SCClassInstance aktualizuje wartości właściwości wystąpienia klasy.

Przykłady

Przykład 1: Oznaczanie wystąpień klasy do usunięcia

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

To polecenie aktualizuje wszystkie wystąpienia elementów konfiguracji klasy System.Printer, aby oznaczyć je do usunięcia.

Przykład 2: Zmienianie wartości lokalizacji wystąpienia elementu konfiguracji Service Manager

PS C:\>Get-SCClassInstance -Class (Get-SCClass -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-SCClassInstance -Class (Get-SCClass -Name "Microsoft.Ad.Printer") -Filter 'Location -eq "Seattle"'| % { $_.Location = "Portland"; $_ } | Update-SCClassInstance
PS C:\>Get-SCClassInstance -Class (Get-SCClass -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

To polecenie zmienia wartość lokalizacji wystąpienia elementu konfiguracji Service Manager.

Parametry

-Confirm

Prosi o potwierdzenie przed uruchomieniem cmdletu.

Właściwości parametru

Typ:System.Management.Automation.SwitchParameter
Domyślna wartość:False
Obsługuje symbole wieloznaczne:False
DontShow:False
Aliasy:por

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-Instance

Określa instancję klasy do zaktualizowania.

Właściwości parametru

Typ:

Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance[]

Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:1
Obowiązkowy:True
Wartość z potoku:True
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-PassThru

Wskazuje, że wystąpienie klasy jest zwracane do bieżącej sesji programu Windows PowerShell po zakończeniu aktualizacji. Ten obiekt wyjściowy można następnie przekazać do innych poleceń cmdlet.

Właściwości parametru

Typ:System.Management.Automation.SwitchParameter
Domyślna wartość:None
Obsługuje symbole wieloznaczne:False
DontShow:False

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

-WhatIf

Pokazuje, co się stanie, jeśli polecenie cmdlet zostanie uruchomione. Cmdlet nie jest uruchomiony.

Właściwości parametru

Typ:SwitchParameterSystem.Management.Automation.SwitchParameter
Domyślna wartość:False
Obsługuje symbole wieloznaczne:False
DontShow:False
Aliasy:Wi

Zestawy parametrów

(All)
Position:Named
Obowiązkowy:False
Wartość z potoku:False
Wartość z potoku według nazwy właściwości:False
Wartość z pozostałych argumentów:False

CommonParameters

To polecenie cmdlet obsługuje typowe parametry: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction i -WarningVariable. Aby uzyskać więcej informacji, zobacz about_CommonParameters.

Dane wejściowe

Microsoft.EnterpriseManagement.Core.Cmdlets.Instances.EnterpriseManagementInstance

Wystąpienie klasy można potokować do parametru Instance polecenia cmdlet Update-SCClassInstance .

Dane wyjściowe

EnterpriseManagementInstance

To polecenie cmdlet generuje obiekt EnterpriseManagementInstance, gdy jest używany parametr.PassThru