diff --git a/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md b/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md index 2d0c6403f1a4..d619ecd815d6 100644 --- a/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md +++ b/reference/5.1/CimCmdlets/Register-CimIndicationEvent.md @@ -36,19 +36,19 @@ Register-CimIndicationEvent [-Namespace ] [-ClassName] ### QueryExpressionSessionSet ``` -Register-CimIndicationEvent [-Namespace ] [-Query] [-QueryDialect ] - [-OperationTimeoutSec ] -CimSession [[-SourceIdentifier] ] - [[-Action] ] [-MessageData ] [-SupportEvent] [-Forward] - [-MaxTriggerCount ] [] +Register-CimIndicationEvent [-Namespace ] [-Query] + [-QueryDialect ] [-OperationTimeoutSec ] -CimSession + [[-SourceIdentifier] ] [[-Action] ] [-MessageData ] + [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] ``` ### QueryExpressionComputerSet ``` -Register-CimIndicationEvent [-Namespace ] [-Query] [-QueryDialect ] - [-OperationTimeoutSec ] [-ComputerName ] [[-SourceIdentifier] ] - [[-Action] ] [-MessageData ] [-SupportEvent] [-Forward] - [-MaxTriggerCount ] [] +Register-CimIndicationEvent [-Namespace ] [-Query] + [-QueryDialect ] [-OperationTimeoutSec ] [-ComputerName ] + [[-SourceIdentifier] ] [[-Action] ] [-MessageData ] + [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] ``` ## DESCRIPTION @@ -67,7 +67,11 @@ This example subscribes to the events generated by the class named **Win32_Proce class raises an event whenever a process starts. ```powershell -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' +} +Register-CimIndicationEvent @event Get-Event -SourceIdentifier "ProcessStarted" ``` @@ -98,7 +102,12 @@ $action = { $id = $event.SourceEventArgs.NewEvent.ProcessId Write-Host -Object "New Process Started : Name = $name ID = $id" } -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -Action $action +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' + Action = $action +} +Register-CimIndicationEvent @event ``` For more information, see @@ -111,7 +120,12 @@ CIM server are stored in the event queue in the current PowerShell session and t `Get-Event` to retrieve the events. ```powershell -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -ComputerName Server01 +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' + ComputerName = 'Server01' +} +Register-CimIndicationEvent @event Get-Event -SourceIdentifier "ProcessStarted" ``` @@ -126,7 +140,7 @@ event is raised, instead of sending the event to the event queue. Enclose the co The script block specified with **Action** can include the `$Event`, `$EventSubscriber`, `$Sender`, `$SourceEventArgs`, and `$SourceArgs` automatic variables, which provide information about the event to the **Action** script block. For more information, see -[About Automatic Variables](../microsoft.powershell.core/about/about_automatic_variables.md). +[About Automatic Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ```yaml Type: System.Management.Automation.ScriptBlock @@ -401,4 +415,3 @@ This cmdlet returns an **EventSubscription** object. [Get-CimSession](Get-CimSession.md) [New-CimSession](New-CimSession.md) - diff --git a/reference/5.1/CimCmdlets/Remove-CimInstance.md b/reference/5.1/CimCmdlets/Remove-CimInstance.md index c1a6b74f4a4c..07dea4673abe 100644 --- a/reference/5.1/CimCmdlets/Remove-CimInstance.md +++ b/reference/5.1/CimCmdlets/Remove-CimInstance.md @@ -17,31 +17,33 @@ Removes a CIM instance from a computer. ### CimInstanceComputerSet (Default) ``` -Remove-CimInstance [-ResourceUri ] [-ComputerName ] [-OperationTimeoutSec ] - [-InputObject] [-WhatIf] [-Confirm] [] +Remove-CimInstance [-ResourceUri ] [-ComputerName ] + [-OperationTimeoutSec ] [-InputObject] [-WhatIf] [-Confirm] + [] ``` ### CimInstanceSessionSet ``` -Remove-CimInstance -CimSession [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-WhatIf] [-Confirm] [] +Remove-CimInstance -CimSession [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-WhatIf] [-Confirm] + [] ``` ### QuerySessionSet ``` Remove-CimInstance -CimSession [[-Namespace] ] - [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] [-Confirm] - [] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] + [-Confirm] [] ``` ### QueryComputerSet ``` Remove-CimInstance [-ComputerName ] [[-Namespace] ] - [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] [-Confirm] - [] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] + [-Confirm] [] ``` ## DESCRIPTION diff --git a/reference/5.1/CimCmdlets/Set-CimInstance.md b/reference/5.1/CimCmdlets/Set-CimInstance.md index 53dffb7dd817..de58c8f0fb70 100644 --- a/reference/5.1/CimCmdlets/Set-CimInstance.md +++ b/reference/5.1/CimCmdlets/Set-CimInstance.md @@ -17,33 +17,33 @@ Modifies a CIM instance on a CIM server by calling the ModifyInstance method of ### CimInstanceComputerSet (Default) ``` -Set-CimInstance [-ComputerName ] [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-Property ] [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance [-ComputerName ] [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-Property ] + [-PassThru] [-WhatIf] [-Confirm] [] ``` ### CimInstanceSessionSet ``` -Set-CimInstance -CimSession [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-Property ] [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance -CimSession [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-Property ] + [-PassThru] [-WhatIf] [-Confirm] [] ``` ### QuerySessionSet ``` -Set-CimInstance -CimSession [-Namespace ] [-OperationTimeoutSec ] - [-Query] [-QueryDialect ] -Property [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance -CimSession [-Namespace ] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] + -Property [-PassThru] [-WhatIf] [-Confirm] [] ``` ### QueryComputerSet ``` -Set-CimInstance [-ComputerName ] [-Namespace ] [-OperationTimeoutSec ] - [-Query] [-QueryDialect ] -Property [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance [-ComputerName ] [-Namespace ] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] + -Property [-PassThru] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -76,7 +76,11 @@ parameter. You can modify instances matching a Windows Management Instrumentatio (WQL) query. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} +$instance = @ { + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} +} +Set-CimInstance @instance ``` ### Example 2: Set the CIM instance property using pipeline @@ -121,7 +125,12 @@ This example uses the common parameter **WhatIf** to specify that the modificati done, but only output what would happen if it were done. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -WhatIf +$instance = @{ + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} + WhatIf = $true +} +Set-CimInstance @instance ``` ### Example 6: Set the CIM instance after confirmation from the user @@ -130,7 +139,12 @@ This example uses the common parameter **Confirm** to specify that the modificat only after confirmation from the user. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -Confirm +$instance = @{ + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} + Confirm = $true +} +Set-CimInstance @instance ``` ### Example 7: Set the created CIM instance @@ -141,7 +155,16 @@ cmdlet, and retrieves its contents in to a variable `$x`. The variable is then p Because the **PassThru** parameter is used, This example returns a modified CIM instance object. ```powershell -$x = New-CimInstance -ClassName Win32_Environment -Property @{Name="testvar";UserName="domain\user"} -Key Name, UserName -ClientOnly +$instance = @{ + ClassName = 'Win32_Environment' + Property = @{ + Name="testvar" + UserName="domain\user" + } + Key = 'Name', 'UserName' + ClientOnly = $true +} +$x = New-CimInstance @instance Set-CimInstance -CimInstance $x -Property @{VariableValue="somevalue"} -PassThru ``` @@ -154,7 +177,7 @@ of a `New-CimSession` or `Get-CimSession` cmdlet. ```yaml Type: Microsoft.Management.Infrastructure.CimSession[] -Parameter Sets: QuerySessionSet, CimInstanceSessionSet +Parameter Sets: CimInstanceSessionSet, QuerySessionSet Aliases: Required: True @@ -395,7 +418,7 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see -[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/7.4/CimCmdlets/Register-CimIndicationEvent.md b/reference/7.4/CimCmdlets/Register-CimIndicationEvent.md index e28caf6c67d0..575d23798867 100644 --- a/reference/7.4/CimCmdlets/Register-CimIndicationEvent.md +++ b/reference/7.4/CimCmdlets/Register-CimIndicationEvent.md @@ -36,19 +36,19 @@ Register-CimIndicationEvent [-Namespace ] [-ClassName] ### QueryExpressionSessionSet ``` -Register-CimIndicationEvent [-Namespace ] [-Query] [-QueryDialect ] - [-OperationTimeoutSec ] -CimSession [[-SourceIdentifier] ] - [[-Action] ] [-MessageData ] [-SupportEvent] [-Forward] - [-MaxTriggerCount ] [] +Register-CimIndicationEvent [-Namespace ] [-Query] + [-QueryDialect ] [-OperationTimeoutSec ] -CimSession + [[-SourceIdentifier] ] [[-Action] ] [-MessageData ] + [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] ``` ### QueryExpressionComputerSet ``` -Register-CimIndicationEvent [-Namespace ] [-Query] [-QueryDialect ] - [-OperationTimeoutSec ] [-ComputerName ] [[-SourceIdentifier] ] - [[-Action] ] [-MessageData ] [-SupportEvent] [-Forward] - [-MaxTriggerCount ] [] +Register-CimIndicationEvent [-Namespace ] [-Query] + [-QueryDialect ] [-OperationTimeoutSec ] [-ComputerName ] + [[-SourceIdentifier] ] [[-Action] ] [-MessageData ] + [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] ``` ## DESCRIPTION @@ -69,7 +69,11 @@ This example subscribes to the events generated by the class named **Win32_Proce class raises an event whenever a process starts. ```powershell -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' +} +Register-CimIndicationEvent @event Get-Event -SourceIdentifier "ProcessStarted" ``` @@ -100,7 +104,12 @@ $action = { $id = $event.SourceEventArgs.NewEvent.ProcessId Write-Host -Object "New Process Started : Name = $name ID = $id" } -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -Action $action +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' + Action = $action +} +Register-CimIndicationEvent @event ``` For more information, see @@ -113,7 +122,12 @@ CIM server are stored in the event queue in the current PowerShell session and t `Get-Event` to retrieve the events. ```powershell -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -ComputerName Server01 +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' + ComputerName = 'Server01' +} +Register-CimIndicationEvent @event Get-Event -SourceIdentifier "ProcessStarted" ``` @@ -128,7 +142,7 @@ event is raised, instead of sending the event to the event queue. Enclose the co The script block specified with **Action** can include the `$Event`, `$EventSubscriber`, `$Sender`, `$SourceEventArgs`, and `$SourceArgs` automatic variables, which provide information about the event to the **Action** script block. For more information, see -[About Automatic Variables](../microsoft.powershell.core/about/about_automatic_variables.md). +[About Automatic Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ```yaml Type: System.Management.Automation.ScriptBlock diff --git a/reference/7.4/CimCmdlets/Remove-CimInstance.md b/reference/7.4/CimCmdlets/Remove-CimInstance.md index c33db4b2a311..5f632ff9a5e1 100644 --- a/reference/7.4/CimCmdlets/Remove-CimInstance.md +++ b/reference/7.4/CimCmdlets/Remove-CimInstance.md @@ -17,31 +17,33 @@ Removes a CIM instance from a computer. ### CimInstanceComputerSet (Default) ``` -Remove-CimInstance [-ResourceUri ] [-ComputerName ] [-OperationTimeoutSec ] - [-InputObject] [-WhatIf] [-Confirm] [] +Remove-CimInstance [-ResourceUri ] [-ComputerName ] + [-OperationTimeoutSec ] [-InputObject] [-WhatIf] [-Confirm] + [] ``` ### CimInstanceSessionSet ``` -Remove-CimInstance -CimSession [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-WhatIf] [-Confirm] [] +Remove-CimInstance -CimSession [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-WhatIf] [-Confirm] + [] ``` ### QuerySessionSet ``` Remove-CimInstance -CimSession [[-Namespace] ] - [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] [-Confirm] - [] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] + [-Confirm] [] ``` ### QueryComputerSet ``` Remove-CimInstance [-ComputerName ] [[-Namespace] ] - [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] [-Confirm] - [] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] + [-Confirm] [] ``` ## DESCRIPTION diff --git a/reference/7.4/CimCmdlets/Set-CimInstance.md b/reference/7.4/CimCmdlets/Set-CimInstance.md index a241fc87f52d..3b10e826c2ac 100644 --- a/reference/7.4/CimCmdlets/Set-CimInstance.md +++ b/reference/7.4/CimCmdlets/Set-CimInstance.md @@ -17,33 +17,33 @@ Modifies a CIM instance on a CIM server by calling the ModifyInstance method of ### CimInstanceComputerSet (Default) ``` -Set-CimInstance [-ComputerName ] [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-Property ] [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance [-ComputerName ] [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-Property ] + [-PassThru] [-WhatIf] [-Confirm] [] ``` ### CimInstanceSessionSet ``` -Set-CimInstance -CimSession [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-Property ] [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance -CimSession [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-Property ] + [-PassThru] [-WhatIf] [-Confirm] [] ``` ### QuerySessionSet ``` -Set-CimInstance -CimSession [-Namespace ] [-OperationTimeoutSec ] - [-Query] [-QueryDialect ] -Property [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance -CimSession [-Namespace ] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] + -Property [-PassThru] [-WhatIf] [-Confirm] [] ``` ### QueryComputerSet ``` -Set-CimInstance [-ComputerName ] [-Namespace ] [-OperationTimeoutSec ] - [-Query] [-QueryDialect ] -Property [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance [-ComputerName ] [-Namespace ] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] + -Property [-PassThru] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -78,7 +78,11 @@ parameter. You can modify instances matching a Windows Management Instrumentatio (WQL) query. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} +$instance = @ { + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} +} +Set-CimInstance @instance ``` ### Example 2: Set the CIM instance property using pipeline @@ -123,7 +127,12 @@ This example uses the common parameter **WhatIf** to specify that the modificati done, but only output what would happen if it were done. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -WhatIf +$instance = @{ + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} + WhatIf = $true +} +Set-CimInstance @instance ``` ### Example 6: Set the CIM instance after confirmation from the user @@ -132,7 +141,12 @@ This example uses the common parameter **Confirm** to specify that the modificat only after confirmation from the user. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -Confirm +$instance = @{ + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} + Confirm = $true +} +Set-CimInstance @instance ``` ### Example 7: Set the created CIM instance @@ -143,7 +157,16 @@ cmdlet, and retrieves its contents in to a variable `$x`. The variable is then p Because the **PassThru** parameter is used, This example returns a modified CIM instance object. ```powershell -$x = New-CimInstance -ClassName Win32_Environment -Property @{Name="testvar";UserName="domain\user"} -Key Name, UserName -ClientOnly +$instance = @{ + ClassName = 'Win32_Environment' + Property = @{ + Name="testvar" + UserName="domain\user" + } + Key = 'Name', 'UserName' + ClientOnly = $true +} +$x = New-CimInstance @instance Set-CimInstance -CimInstance $x -Property @{VariableValue="somevalue"} -PassThru ``` @@ -397,7 +420,7 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see -[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/7.5/CimCmdlets/Register-CimIndicationEvent.md b/reference/7.5/CimCmdlets/Register-CimIndicationEvent.md index 837e2b12a407..46816b9697dc 100644 --- a/reference/7.5/CimCmdlets/Register-CimIndicationEvent.md +++ b/reference/7.5/CimCmdlets/Register-CimIndicationEvent.md @@ -36,19 +36,19 @@ Register-CimIndicationEvent [-Namespace ] [-ClassName] ### QueryExpressionSessionSet ``` -Register-CimIndicationEvent [-Namespace ] [-Query] [-QueryDialect ] - [-OperationTimeoutSec ] -CimSession [[-SourceIdentifier] ] - [[-Action] ] [-MessageData ] [-SupportEvent] [-Forward] - [-MaxTriggerCount ] [] +Register-CimIndicationEvent [-Namespace ] [-Query] + [-QueryDialect ] [-OperationTimeoutSec ] -CimSession + [[-SourceIdentifier] ] [[-Action] ] [-MessageData ] + [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] ``` ### QueryExpressionComputerSet ``` -Register-CimIndicationEvent [-Namespace ] [-Query] [-QueryDialect ] - [-OperationTimeoutSec ] [-ComputerName ] [[-SourceIdentifier] ] - [[-Action] ] [-MessageData ] [-SupportEvent] [-Forward] - [-MaxTriggerCount ] [] +Register-CimIndicationEvent [-Namespace ] [-Query] + [-QueryDialect ] [-OperationTimeoutSec ] [-ComputerName ] + [[-SourceIdentifier] ] [[-Action] ] [-MessageData ] + [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] ``` ## DESCRIPTION @@ -69,7 +69,11 @@ This example subscribes to the events generated by the class named **Win32_Proce class raises an event whenever a process starts. ```powershell -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' +} +Register-CimIndicationEvent @event Get-Event -SourceIdentifier "ProcessStarted" ``` @@ -100,7 +104,12 @@ $action = { $id = $event.SourceEventArgs.NewEvent.ProcessId Write-Host -Object "New Process Started : Name = $name ID = $id" } -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -Action $action +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' + Action = $action +} +Register-CimIndicationEvent @event ``` For more information, see @@ -113,7 +122,12 @@ CIM server are stored in the event queue in the current PowerShell session and t `Get-Event` to retrieve the events. ```powershell -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -ComputerName Server01 +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' + ComputerName = 'Server01' +} +Register-CimIndicationEvent @event Get-Event -SourceIdentifier "ProcessStarted" ``` @@ -128,7 +142,7 @@ event is raised, instead of sending the event to the event queue. Enclose the co The script block specified with **Action** can include the `$Event`, `$EventSubscriber`, `$Sender`, `$SourceEventArgs`, and `$SourceArgs` automatic variables, which provide information about the event to the **Action** script block. For more information, see -[About Automatic Variables](../microsoft.powershell.core/about/about_automatic_variables.md). +[About Automatic Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ```yaml Type: System.Management.Automation.ScriptBlock diff --git a/reference/7.5/CimCmdlets/Remove-CimInstance.md b/reference/7.5/CimCmdlets/Remove-CimInstance.md index 7787a946205a..dd77ab2d9766 100644 --- a/reference/7.5/CimCmdlets/Remove-CimInstance.md +++ b/reference/7.5/CimCmdlets/Remove-CimInstance.md @@ -17,31 +17,33 @@ Removes a CIM instance from a computer. ### CimInstanceComputerSet (Default) ``` -Remove-CimInstance [-ResourceUri ] [-ComputerName ] [-OperationTimeoutSec ] - [-InputObject] [-WhatIf] [-Confirm] [] +Remove-CimInstance [-ResourceUri ] [-ComputerName ] + [-OperationTimeoutSec ] [-InputObject] [-WhatIf] [-Confirm] + [] ``` ### CimInstanceSessionSet ``` -Remove-CimInstance -CimSession [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-WhatIf] [-Confirm] [] +Remove-CimInstance -CimSession [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-WhatIf] [-Confirm] + [] ``` ### QuerySessionSet ``` Remove-CimInstance -CimSession [[-Namespace] ] - [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] [-Confirm] - [] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] + [-Confirm] [] ``` ### QueryComputerSet ``` Remove-CimInstance [-ComputerName ] [[-Namespace] ] - [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] [-Confirm] - [] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] + [-Confirm] [] ``` ## DESCRIPTION diff --git a/reference/7.5/CimCmdlets/Set-CimInstance.md b/reference/7.5/CimCmdlets/Set-CimInstance.md index f7cda96c2aa8..2fafa248fc89 100644 --- a/reference/7.5/CimCmdlets/Set-CimInstance.md +++ b/reference/7.5/CimCmdlets/Set-CimInstance.md @@ -17,33 +17,33 @@ Modifies a CIM instance on a CIM server by calling the ModifyInstance method of ### CimInstanceComputerSet (Default) ``` -Set-CimInstance [-ComputerName ] [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-Property ] [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance [-ComputerName ] [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-Property ] + [-PassThru] [-WhatIf] [-Confirm] [] ``` ### CimInstanceSessionSet ``` -Set-CimInstance -CimSession [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-Property ] [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance -CimSession [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-Property ] + [-PassThru] [-WhatIf] [-Confirm] [] ``` ### QuerySessionSet ``` -Set-CimInstance -CimSession [-Namespace ] [-OperationTimeoutSec ] - [-Query] [-QueryDialect ] -Property [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance -CimSession [-Namespace ] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] + -Property [-PassThru] [-WhatIf] [-Confirm] [] ``` ### QueryComputerSet ``` -Set-CimInstance [-ComputerName ] [-Namespace ] [-OperationTimeoutSec ] - [-Query] [-QueryDialect ] -Property [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance [-ComputerName ] [-Namespace ] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] + -Property [-PassThru] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -78,7 +78,11 @@ parameter. You can modify instances matching a Windows Management Instrumentatio (WQL) query. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} +$instance = @ { + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} +} +Set-CimInstance @instance ``` ### Example 2: Set the CIM instance property using pipeline @@ -123,7 +127,12 @@ This example uses the common parameter **WhatIf** to specify that the modificati done, but only output what would happen if it were done. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -WhatIf +$instance = @{ + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} + WhatIf = $true +} +Set-CimInstance @instance ``` ### Example 6: Set the CIM instance after confirmation from the user @@ -132,7 +141,12 @@ This example uses the common parameter **Confirm** to specify that the modificat only after confirmation from the user. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -Confirm +$instance = @{ + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} + Confirm = $true +} +Set-CimInstance @instance ``` ### Example 7: Set the created CIM instance @@ -143,7 +157,16 @@ cmdlet, and retrieves its contents in to a variable `$x`. The variable is then p Because the **PassThru** parameter is used, This example returns a modified CIM instance object. ```powershell -$x = New-CimInstance -ClassName Win32_Environment -Property @{Name="testvar";UserName="domain\user"} -Key Name, UserName -ClientOnly +$instance = @{ + ClassName = 'Win32_Environment' + Property = @{ + Name="testvar" + UserName="domain\user" + } + Key = 'Name', 'UserName' + ClientOnly = $true +} +$x = New-CimInstance @instance Set-CimInstance -CimInstance $x -Property @{VariableValue="somevalue"} -PassThru ``` @@ -397,7 +420,7 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see -[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/reference/7.6/CimCmdlets/Register-CimIndicationEvent.md b/reference/7.6/CimCmdlets/Register-CimIndicationEvent.md index 5b23f3048e27..379be06226e4 100644 --- a/reference/7.6/CimCmdlets/Register-CimIndicationEvent.md +++ b/reference/7.6/CimCmdlets/Register-CimIndicationEvent.md @@ -36,19 +36,19 @@ Register-CimIndicationEvent [-Namespace ] [-ClassName] ### QueryExpressionSessionSet ``` -Register-CimIndicationEvent [-Namespace ] [-Query] [-QueryDialect ] - [-OperationTimeoutSec ] -CimSession [[-SourceIdentifier] ] - [[-Action] ] [-MessageData ] [-SupportEvent] [-Forward] - [-MaxTriggerCount ] [] +Register-CimIndicationEvent [-Namespace ] [-Query] + [-QueryDialect ] [-OperationTimeoutSec ] -CimSession + [[-SourceIdentifier] ] [[-Action] ] [-MessageData ] + [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] ``` ### QueryExpressionComputerSet ``` -Register-CimIndicationEvent [-Namespace ] [-Query] [-QueryDialect ] - [-OperationTimeoutSec ] [-ComputerName ] [[-SourceIdentifier] ] - [[-Action] ] [-MessageData ] [-SupportEvent] [-Forward] - [-MaxTriggerCount ] [] +Register-CimIndicationEvent [-Namespace ] [-Query] + [-QueryDialect ] [-OperationTimeoutSec ] [-ComputerName ] + [[-SourceIdentifier] ] [[-Action] ] [-MessageData ] + [-SupportEvent] [-Forward] [-MaxTriggerCount ] [] ``` ## DESCRIPTION @@ -69,7 +69,11 @@ This example subscribes to the events generated by the class named **Win32_Proce class raises an event whenever a process starts. ```powershell -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' +} +Register-CimIndicationEvent @event Get-Event -SourceIdentifier "ProcessStarted" ``` @@ -100,7 +104,12 @@ $action = { $id = $event.SourceEventArgs.NewEvent.ProcessId Write-Host -Object "New Process Started : Name = $name ID = $id" } -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -Action $action +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' + Action = $action +} +Register-CimIndicationEvent @event ``` For more information, see @@ -113,7 +122,12 @@ CIM server are stored in the event queue in the current PowerShell session and t `Get-Event` to retrieve the events. ```powershell -Register-CimIndicationEvent -ClassName 'Win32_ProcessStartTrace' -SourceIdentifier "ProcessStarted" -ComputerName Server01 +$event = @{ + ClassName = 'Win32_ProcessStartTrace' + SourceIdentifier = 'ProcessStarted' + ComputerName = 'Server01' +} +Register-CimIndicationEvent @event Get-Event -SourceIdentifier "ProcessStarted" ``` @@ -128,7 +142,7 @@ event is raised, instead of sending the event to the event queue. Enclose the co The script block specified with **Action** can include the `$Event`, `$EventSubscriber`, `$Sender`, `$SourceEventArgs`, and `$SourceArgs` automatic variables, which provide information about the event to the **Action** script block. For more information, see -[About Automatic Variables](../microsoft.powershell.core/about/about_automatic_variables.md). +[About Automatic Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md). ```yaml Type: System.Management.Automation.ScriptBlock diff --git a/reference/7.6/CimCmdlets/Remove-CimInstance.md b/reference/7.6/CimCmdlets/Remove-CimInstance.md index f52e154ace1b..ac0f9d745f1b 100644 --- a/reference/7.6/CimCmdlets/Remove-CimInstance.md +++ b/reference/7.6/CimCmdlets/Remove-CimInstance.md @@ -17,31 +17,33 @@ Removes a CIM instance from a computer. ### CimInstanceComputerSet (Default) ``` -Remove-CimInstance [-ResourceUri ] [-ComputerName ] [-OperationTimeoutSec ] - [-InputObject] [-WhatIf] [-Confirm] [] +Remove-CimInstance [-ResourceUri ] [-ComputerName ] + [-OperationTimeoutSec ] [-InputObject] [-WhatIf] [-Confirm] + [] ``` ### CimInstanceSessionSet ``` -Remove-CimInstance -CimSession [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-WhatIf] [-Confirm] [] +Remove-CimInstance -CimSession [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-WhatIf] [-Confirm] + [] ``` ### QuerySessionSet ``` Remove-CimInstance -CimSession [[-Namespace] ] - [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] [-Confirm] - [] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] + [-Confirm] [] ``` ### QueryComputerSet ``` Remove-CimInstance [-ComputerName ] [[-Namespace] ] - [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] [-Confirm] - [] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] [-WhatIf] + [-Confirm] [] ``` ## DESCRIPTION diff --git a/reference/7.6/CimCmdlets/Set-CimInstance.md b/reference/7.6/CimCmdlets/Set-CimInstance.md index 6566f790ce30..ffb7ccd87334 100644 --- a/reference/7.6/CimCmdlets/Set-CimInstance.md +++ b/reference/7.6/CimCmdlets/Set-CimInstance.md @@ -17,33 +17,33 @@ Modifies a CIM instance on a CIM server by calling the ModifyInstance method of ### CimInstanceComputerSet (Default) ``` -Set-CimInstance [-ComputerName ] [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-Property ] [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance [-ComputerName ] [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-Property ] + [-PassThru] [-WhatIf] [-Confirm] [] ``` ### CimInstanceSessionSet ``` -Set-CimInstance -CimSession [-ResourceUri ] [-OperationTimeoutSec ] - [-InputObject] [-Property ] [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance -CimSession [-ResourceUri ] + [-OperationTimeoutSec ] [-InputObject] [-Property ] + [-PassThru] [-WhatIf] [-Confirm] [] ``` ### QuerySessionSet ``` -Set-CimInstance -CimSession [-Namespace ] [-OperationTimeoutSec ] - [-Query] [-QueryDialect ] -Property [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance -CimSession [-Namespace ] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] + -Property [-PassThru] [-WhatIf] [-Confirm] [] ``` ### QueryComputerSet ``` -Set-CimInstance [-ComputerName ] [-Namespace ] [-OperationTimeoutSec ] - [-Query] [-QueryDialect ] -Property [-PassThru] [-WhatIf] [-Confirm] - [] +Set-CimInstance [-ComputerName ] [-Namespace ] + [-OperationTimeoutSec ] [-Query] [-QueryDialect ] + -Property [-PassThru] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -78,7 +78,11 @@ parameter. You can modify instances matching a Windows Management Instrumentatio (WQL) query. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} +$instance = @ { + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} +} +Set-CimInstance @instance ``` ### Example 2: Set the CIM instance property using pipeline @@ -123,7 +127,12 @@ This example uses the common parameter **WhatIf** to specify that the modificati done, but only output what would happen if it were done. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -WhatIf +$instance = @{ + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} + WhatIf = $true +} +Set-CimInstance @instance ``` ### Example 6: Set the CIM instance after confirmation from the user @@ -132,7 +141,12 @@ This example uses the common parameter **Confirm** to specify that the modificat only after confirmation from the user. ```powershell -Set-CimInstance -Query 'Select * from Win32_Environment where name LIKE "testvar%"' -Property @{VariableValue="abcd"} -Confirm +$instance = @{ + Query = 'Select * from Win32_Environment where name LIKE "testvar%"' + Property = @{VariableValue="abcd"} + Confirm = $true +} +Set-CimInstance @instance ``` ### Example 7: Set the created CIM instance @@ -143,7 +157,16 @@ cmdlet, and retrieves its contents in to a variable `$x`. The variable is then p Because the **PassThru** parameter is used, This example returns a modified CIM instance object. ```powershell -$x = New-CimInstance -ClassName Win32_Environment -Property @{Name="testvar";UserName="domain\user"} -Key Name, UserName -ClientOnly +$instance = @{ + ClassName = 'Win32_Environment' + Property = @{ + Name="testvar" + UserName="domain\user" + } + Key = 'Name', 'UserName' + ClientOnly = $true +} +$x = New-CimInstance @instance Set-CimInstance -CimInstance $x -Property @{VariableValue="somevalue"} -PassThru ``` @@ -397,7 +420,7 @@ Accept wildcard characters: False This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see -[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md). +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS