-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMigrate_CommitChanges_Schema.ps1
34 lines (27 loc) · 1.23 KB
/
Migrate_CommitChanges_Schema.ps1
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
##############################################################################################################
# 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\SchemaChanges.xml"
$undone_filename = "D:\code\base\serviceconfig\SchemaChanges_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."
}