You must import the PowerShell snap-in for use with Universal Policy Administrator. To import, execute the cmdlet from a PowerShell prompt as in the following snippet:
add-pssnapin HAPI.ProviderPowershellSnapin
After you load the PowerShell snap-in, to view the list of supported cmdlets you must execute the cmdlet from a PowerShell prompt as in the following snippet:
get-command -module HAPI.ProviderPowershellSnapin
The outputs provides a complete list of cmdlets that Universal Policy Administrator supports. For more information, see Supported PowerShell Cmdlets
You can view a sample cmdlet detail from a PowerShell prompt as in the following command:
get-help Get-UniversalPolicy -detailed
NAME
Get-UniversalPolicy
SYNTAX
Get-UniversalPolicy [-AllDetails <SwitchParameter>] [-BranchName <string>] [-Domain <string>] [-LoadGPOId
<string>] [-PolicyId <string>] [-PreviousVersion <bool>] [-SectionId <string>] [-SpecificVersion <int>] [-UPId
<string>] [<CommonParameters>]
DESCRIPTION
The Get-UniversalPolicy cmdlet gets the properties for a specified Universal Policy, or all Universal Policies.
PARAMETERS
-LoadGPOId <string>
Obsolete. Use New-UniversalPolicy + Import-UniversalPolicy instead. (optional) Specifies the Guid of a GPO to
import into a new UP.
-load <string>
Obsolete. Use New-UniversalPolicy + Import-UniversalPolicy instead. (optional) Specifies the Guid of a GPO to
import into a new UP.
This is an alias of the LoadGPOId parameter.
-UPId <string>
Id of the UP to retrieve. If not specified, all UPs will be retrieved.
-PolicyId <string>
If specified, Policy within the UP to retrieve.
-SectionId <string>
If specified, Section within the UP to retrieve.
-AllDetails <SwitchParameter>
If this flag is set, the results will include the Policies, Sections, and Settings within the UP. Otherwise,
only the UP properties will be returned.
-PreviousVersion <bool>
True to retrieve a previous version of the UP.
-SpecificVersion <int>
If specified, Version of the UP to retrieve.
-BranchName <string>
(Optional) The branch where the Universal Policy is retrieved from.
-Domain <string>
(Optional) The name of the domain where the Universal Policy is retrieved from.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
---------- EXAMPLE 1 ----------
This example opens a HAPI session, and then retrieves all Universal Policies from the domain
'mydomain.com'Get-Credential | Get-HAPIConnection -url "https://dev.hapidevelopment.com"
Open the PowerShell console.
Navigate to the PowerShell Snapin folder path.
Enter the following command to load the HAPI.ProviderPowershellSnapin snap-in:
Add-PSSnapin HAPI.ProviderPowershellSnapin
Use the scripts below to view the Differential Reports:
NOTE:The UP Id is obtained by selecting the universal policy for which you need the report and navigating to the ‘Advanced’ tab.
Retrieve a differential report between two different Universal Policies using the Get-DiffReport cmdlet.
$resp = Get-DiffReport -UPId '<UPId>' -SecondUPId '<SecondUPId>'
$resp.Changes.Count
$resp.Changes
The Get-DiffReport cmdlet generates a differential report between two Universal Policies (UPs). This report highlights the changes between the specified UPs, providing details on the number of changes and the specific differences.
|
Attribute / Description |
Parameters / Values |
||||
|---|---|---|---|---|---|
|
Required |
Position |
Default Value |
Accept Pipeline input? |
Accept wildcard characters? |
|
|
UPId <String> The unique identifier of the first Universal Policy. |
true |
named |
false |
false |
|
|
Second UPId <String> An array of existing Active Directory groups to assign specified by distinguished name. |
true |
named |
false |
false |
|
Example A-1 1
$resp = Get-DiffReport -UPId 'bdc31f11-0683-42e3-9c72-2157ad2c9393' -SecondUPId '657583b1-f749-4b8c-a3a5-45b5e9bbb425' $resp.Changes.Count $resp.Changes
In this example, the Get-DiffReport cmdlet is used to generate a differential report between two Universal Policies (UPs). The command $resp = Get-DiffReport -UPId 'bdc31f11-0683-42e3-9c72-2157ad2c9393' -SecondUPId '657583b1-f749-4b8c-a3a5-45b5e9bbb425' compares the two specified UPs and stores the result in the variable $resp.
Retrieve a differential report for a specific Universal Policy between the current version and the last checked-in version using the Get-DiffReport cmdlet.
$resp = Get-DiffReport -UPId 'XXX' -CheckedOutVersusCheckedIn
The Get-DiffReport cmdlet generates a differential report for a specific Universal Policy, comparing the current version of the Universal Policy with its last checked-in version. This report highlights the changes made since the last check-in, providing details on the number of changes and the specific differences.
|
Attribute / Description |
Parameters / Values |
||||
|---|---|---|---|---|---|
|
Required |
Position |
Default Value |
Accept Pipeline input? |
Accept wildcard characters? |
|
|
UPId <String> The unique identifier of the Universal Policy. |
true |
named |
false |
false |
|
|
CheckedOutVersusCheckedIn <SwitchParameter> Compares the current version with the last checked-in version. |
true |
named |
false |
false |
|
Example A-2 2
$resp = Get-DiffReport -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' -CheckedOutVersusCheckedIn
In this example, the Get-DiffReport cmdlet is used to generate a differential report for a specific Universal Policy (UP), comparing its current version with the last checked-in version. The command $resp = Get-DiffReport -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' -CheckedOutVersusCheckedIn specifies the unique identifier of the UP with -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' and uses the -CheckedOutVersusCheckedIn switch parameter to indicate that the comparison should be between the current version and the last checked-in version.
Retrieve a differential report for a specific Universal Policy between the current version and the last approved using the Get-DiffReport cmdlet.
$resp = Get-DiffReport -UPId 'XXX' -CheckedOutVersusApproved
The Get-DiffReport cmdlet generates a differential report for a specific Universal Policy, comparing the current version of the Universal Policy with its last approved version. This report highlights the changes made since the last approval, providing details on the number of changes and the specific differences.
|
Attribute / Description |
Parameters / Values |
||||
|---|---|---|---|---|---|
|
Required |
Position |
Default Value |
Accept Pipeline input? |
Accept wildcard characters? |
|
|
UPId <String> The unique identifier of the Universal Policy. |
true |
named |
false |
false |
|
|
CheckedOutVersusApproved <SwitchParameter> Compares the current version with the last approved version. |
true |
named |
false |
false |
|
Example A-3 3
$resp = Get-DiffReport -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' -CheckedOutVersusApproved
In this example, the Get-DiffReport cmdlet is used to generate a differential report for a specific Universal Policy (UP), comparing its current version with the last approved version. The command $resp = Get-DiffReport -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' -CheckedOutVersusApproved specifies the unique identifier of the UP with -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' and uses the -CheckedOutVersusApproved switch parameter to indicate that the comparison should be between the current version and the last approved version.
Retrieve a differential report for a specific Universal Policy between the current version and the last two versions using the Get-DiffReport cmdlet.
$resp = Get-DiffReport -UPId 'XXX' -CheckedOutVersusLast2Versions $True$
The Get-DiffReport cmdlet generates a differential report for a specific Universal Policy, comparing the current version of the Universal Policy with its last two versions. This report highlights the changes made over the last two versions, providing details on the number of changes and the specific differences.
|
Attribute / Description |
Parameters / Values |
||||
|---|---|---|---|---|---|
|
Required |
Position |
Default Value |
Accept Pipeline input? |
Accept wildcard characters? |
|
|
UPId <String> The unique identifier of the Universal Policy. |
true |
named |
false |
false |
|
|
CheckedOutVersusLast2Versions <SwitchParameter> Compares the current version with the last two versions. |
true |
named |
false |
false |
|
Example A-4 4
$resp = Get-DiffReport -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' -CheckedOutVersusLast2Versions $True$
In this example, the Get-DiffReport cmdlet is used to generate a differential report for a specific Universal Policy, comparing its current version with the last two versions. The command $resp = Get-DiffReport -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' -CheckedOutVersusLast2Versions $True$ specifies the unique identifier of the Universal Policy with -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' and uses the -CheckedOutVersusLast2Versions $True$ switch parameter to indicate that the comparison should be between the current version and the last two versions.
Retrieve a differential report for a specific Universal Policy between the current version and the version in Group Policy Object in Active Directory using the Get-DiffReport cmdlet.
$resp = Get-DiffReport -UPId 'XXX' -CheckedOutVersusGPOInAD
The Get-DiffReport cmdlet generates a differential report for a specific Universal Policy (UP), comparing the current version of the UP with the version stored in the Group Policy Object (GPO) in Active Directory (AD). This report highlights the changes made between the two versions, providing details on the number of changes and the specific differences.
|
Attribute / Description |
Parameters / Values |
||||
|---|---|---|---|---|---|
|
Required |
Position |
Default Value |
Accept Pipeline input? |
Accept wildcard characters? |
|
|
UPId <String> The unique identifier of the Universal Policy. |
true |
named |
false |
false |
|
|
CheckedOutVersusGPOInAD <SwitchParameter> Compares the current version with the version in GPO in AD |
true |
named |
false |
false |
|
Example A-5 5
$resp = Get-DiffReport -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' -CheckedOutVersusGPOInAD
In this example, the Get-DiffReport cmdlet is used to generate a differential report for a specific Universal Policy (UP), comparing its current version with the version stored in the Group Policy Object (GPO) in Active Directory (AD). The command $resp = Get-DiffReport -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' -CheckedOutVersusGPOInAD specifies the unique identifier of the UP with -UPId '1971ceca-7875-4a5f-8365-faa4bcdf07fa' and uses the -CheckedOutVersusGPOInAD switch parameter to indicate that the comparison should be between the current version and the version in GPO in AD.