-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMigrate_CommitChanges_Policies.ps1
More file actions
35 lines (28 loc) · 1.23 KB
/
Migrate_CommitChanges_Policies.ps1
File metadata and controls
35 lines (28 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
##############################################################################################################
# CommitChanges.ps1
# Copyright © 2009 Microsoft Corporation
#
# This script applies the changes necessary to migrate configuration.
##############################################################################################################
if(@(get-pssnapin | where-object {$_.Name -eq "FIMAutomation"} ).count -eq 0) {add-pssnapin FIMAutomation}
$changes_filename = "d:\code\base\serviceconfig\policychanges.xml"
$undone_filename = "d:\code\base\serviceconfig\policychanges_undone.xml"
$imports = ConvertTo-FIMResource -file $changes_filename
if($imports -eq $null)
{
throw (new-object NullReferenceException -ArgumentList "Changes is null. Check that the changes file has data.")
}
Write-Host "Importing changes into production."
$undoneImports = $imports | Import-FIMConfig
if($undoneImports -eq $null)
{
Write-Host "Import complete."
}
else
{
Write-Host
Write-Host "There were " $undoneImports.Count " uncompleted imports."
$undoneImports | ConvertFrom-FIMResource -file $undone_filename
Write-Host
Write-Host "Please see the documentation on how to resolve the issues."
}