.SYNOPSIS

Asserts that a CSObject contains the expected attribute value

.DESCRIPTION

The Assert-CSAttribute function checks the CSObject for an attribute
It then asserts the attribute value

PARAMETER MIIS_CSObject

The MIIS_CSObject as the WMI object from FIM

PARAMETER CSAttributeName

The CS Attribute name to test

PARAMETER CSAttributeValue

The CS Attribute value to test

PARAMETER Hologram

The location in the CSObject to look for the attribute
Must be one of: Hologram, EscrowedExportHologram, PendingImportHologram, UnappliedExportHologram, UnconfirmedExportHologram

.OUTPUTS

Console output with the assertion results

.EXAMPLE

Use a variable to store the CS object, then use that variable as a parameter value for Assert-CSAttribute.
$CSObject = Get-MIIS_CSObject -ManagementAgent AD -DN 'CN=HoofHearted,DC=IceMelted,DC=ca'
C:\PS>Assert-CSAttribute -MIIS_CSObject $CSObject -CSAttributeName userPrincipalName -CSAttributeValue hoofhearted@icemelted.ca -Hologram UnappliedExportHologram

.EXAMPLE

Use a variable to store the CS object, then use that variable as a parameter value for Assert-CSAttribute. This time omit the parameter names (looks cleaner) and depend on parameter positioning.
$CSObject = Get-MIIS_CSObject -ManagementAgent AD -DN 'CN=HoofHearted,DC=IceMelted,DC=ca'
Assert-CSAttribute -MIIS_CSObject $CSObject userPrincipalName hoofhearted@icemelted.ca 
Assert-CSAttribute -MIIS_CSObject $CSObject samAccountName hoofhearted
Assert-CSAttribute -MIIS_CSObject $CSObject givenName hoof
Assert-CSAttribute -MIIS_CSObject $CSObject sn hearted

.EXAMPLE

Pipe the output of Get-MIIS_CSObject into Assert-CSAttribute.
Get-MIIS_CSObject -ManagementAgent AD -DN 'CN=HoofHearted,DC=IceMelted,DC=ca' | Assert-CSAttribute userPrincipalName hoofhearted@icemelted.ca

Last edited Aug 14, 2012 at 3:36 AM by CraigMartin, version 2

Comments

CraigMartin Nov 1, 2012 at 4:42 PM 
Exactly! That is where it was born ;-)

DavidLundell Oct 30, 2012 at 7:17 PM 
This must be great for automated tests!