Sign in
Home
Library
Wiki
Learn
Gallery
Downloads
Support
Forums
Blogs
Resources For IT Professionals
United States (English)
Россия (Pусский)
中国(简体中文)
Brasil (Português)
Post an article
Translate this page
Powered by
Microsoft® Translator
Wikis - Page Details
First published by
David Steadman - MSFT
(Microsoft, Microsoft Partner)
When:
16 Apr 2012 1:12 PM
Last revision by
Markus Vilcinskas
(Microsoft)
When:
12 Mar 2013 11:52 PM
Revisions:
10
Comments:
0
Options
Subscribe to Article (RSS)
Share this
Can You Improve This Article?
Positively!
Click Sign In to add the tip, solution, correction or comment that will help other users.
Report inappropriate content using
these instructions
.
Wiki
>
TechNet Articles
>
How to Use PowerShell to export Criteria-based groups and filter
How to Use PowerShell to export Criteria-based groups and filter
Article
History
How to Use PowerShell to export Criteria-based groups and filter
FIM ScriptBox Item
Summary
The script list all Criteria-based groups and the filter.
Script Code
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
##.\Group_export.ps1 | Out-File -filepath “C:\Groupexport\Group_export.txt” -append
if
(
@(
get-pssnapin
|
where-object
{
$_
.
Name
-eq
"FIMAutomation"
}
)
.
count
-eq
0
)
{
Add-PSSnapIn
FIMAutomation
}
set-variable
-name
URI
-value
"http://svr2:5725/resourcemanagementservice"
Function
GetAttribute
{
Param
(
$ExportObject
,
$AttributeName
)
End
{
$attributeValue
=
(
$ExportObject
.
ResourceManagementObject
.
ResourceManagementAttributes
|
`
Where-Object
{
$_
.
AttributeName
-eq
$AttributeName
}
)
.
Value
If
(
$attributeValue
-eq
$null
)
{
$attributeValue
=
""
}
Return
$attributeValue
}
}
$exportObject
=
export-fimconfig
-uri
$URI
`
–onlyBaseResources
`
-customconfig
"/Group[MembershipLocked = true]"
$exportObject
|
ForEach
{
$displayName
=
GetAttribute
-ExportObject
$_
-AttributeName
"DisplayName"
$filter
=
GetAttribute
-ExportObject
$_
-AttributeName
"filter"
$filter
=
$filter
.
Substring
(
231
)
$filter
=
$filter
-replace
"</Filter>"
,
""
$filter
=
$filter
-split
"="
(
$displayName
+
"~"
+
$filter
)
}
Note
To provide feedback about this article, create a post on the
FIM TechNet Forum
.
For more FIM related Windows PowerShell scripts, see the
FIM ScriptBox
en-US
,
FIM
,
FIM How To Script
,
FIM Portal
,
FIM ScriptBox Item