<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Isaac&#039;s Blog &#187; SSP</title>
	<atom:link href="http://blog.isaacblum.com/tag/ssp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.isaacblum.com</link>
	<description>So Many Rambles So Little Time....</description>
	<lastBuildDate>Wed, 28 Dec 2011 21:10:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PowerShell &#8211; Bulk Update MOSS Profile</title>
		<link>http://blog.isaacblum.com/2010/01/21/powershell-bulk-update-moss-profile/</link>
		<comments>http://blog.isaacblum.com/2010/01/21/powershell-bulk-update-moss-profile/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 15:33:47 +0000</pubDate>
		<dc:creator>IsaacBlum</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[For The Greater Good]]></category>
		<category><![CDATA[Free Help]]></category>
		<category><![CDATA[MOSS 2007]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Bulk]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Profile]]></category>
		<category><![CDATA[SSP]]></category>
		<category><![CDATA[Update]]></category>

		<guid isPermaLink="false">http://blog.isaacblum.com/?p=257</guid>
		<description><![CDATA[The below links were used to create this script. Thanks http://blogs.msdn.com/powershell/archive/2009/01/10/capture-console-screen.aspx http://www.sharepointdevwiki.com/display/public/Updating+User+Profiles+in+SharePoint+SSP+using+PowerShell http://blogs.flexnetconsult.co.uk/colinbyrne/PermaLink,guid,a332015d-c5dc-4433-a0f3-247fd37b0b04.aspx Download the file here 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 36 37 38 [...]]]></description>
			<content:encoded><![CDATA[<p>The below links were used to create this script. Thanks</p>
<p>http://blogs.msdn.com/powershell/archive/2009/01/10/capture-console-screen.aspx</p>
<p>http://www.sharepointdevwiki.com/display/public/Updating+User+Profiles+in+SharePoint+SSP+using+PowerShell</p>
<p>http://blogs.flexnetconsult.co.uk/colinbyrne/PermaLink,guid,a332015d-c5dc-4433-a0f3-247fd37b0b04.aspx</p>
<p>Download the file <a href="http://blog.isaacblum.com/wp-content/uploads/2010/01/Bulk-Update-MOSS-profiles.ps1">here</a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
</pre></td><td class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>void<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>reflection.assembly<span style="color: #000000;">&#93;</span>::<span style="color: #800000;">Load</span>withpartialname<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Microsoft.SharePoint&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out-null</span>
<span style="color: #000000;">&#91;</span>void<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>reflection.assembly<span style="color: #000000;">&#93;</span>::<span style="color: #800000;">Load</span>withpartialname<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Microsoft.Office.Server.Search&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out-null</span>
<span style="color: #000000;">&#91;</span>void<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>reflection.assembly<span style="color: #000000;">&#93;</span>::<span style="color: #800000;">Load</span>withpartialname<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;Microsoft.Office.Server&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out-null</span>
&nbsp;
<span style="color: #008000;">#################################################################################################################</span>
<span style="color: #008000;"># Get-ConsoleAsText.ps1</span>
<span style="color: #008000;"># Thanks to http://blogs.msdn.com/powershell/archive/2009/01/10/capture-console-screen.aspx for Get-ConsoleAsText.ps1</span>
<span style="color: #008000;"># The script captures console screen buffer up to the current cursor position and returns it in plain text format.</span>
<span style="color: #008000;">#</span>
<span style="color: #008000;"># Returns: ASCII-encoded string.</span>
<span style="color: #008000;">#</span>
<span style="color: #008000;"># Example:</span>
<span style="color: #008000;">#</span>
<span style="color: #008000;"># $textFileName = &quot;$env:tempConsoleBuffer.txt&quot;</span>
<span style="color: #008000;"># .Get-ConsoleAsText | out-file $textFileName -encoding ascii</span>
<span style="color: #008000;"># $null = [System.Diagnostics.Process]::Start(&quot;$textFileName&quot;)</span>
<span style="color: #008000;">#################################################################################################################</span>
<span style="color: #0000FF;">function</span> Get<span style="color: pink;">-</span>ConsoleAsText<span style="color: #000000;">&#123;</span>
<span style="color: #008000;"># Check the host name and exit if the host is not the Windows PowerShell console host.</span>
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$host</span>.Name <span style="color: #FF0000;">-ne</span> <span style="color: #800000;">'ConsoleHost'</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
  <span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #008080; font-style: italic;">-ForegroundColor</span> Red <span style="color: #800000;">&quot;This script runs only in the console host. You cannot run this script in $($host.Name).&quot;</span>
  exit <span style="color: pink;">-</span><span style="color: #804000;">1</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># Initialize string builder.</span>
<span style="color: #800080;">$textBuilder</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> system.text.stringbuilder
&nbsp;
<span style="color: #008000;"># Grab the console screen buffer contents using the Host console API.</span>
<span style="color: #800080;">$bufferWidth</span> <span style="color: pink;">=</span> <span style="color: #800080;">$host</span>.ui.rawui.BufferSize.Width
<span style="color: #800080;">$bufferHeight</span> <span style="color: pink;">=</span> <span style="color: #800080;">$host</span>.ui.rawui.CursorPosition.Y
<span style="color: #800080;">$rec</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> System.Management.Automation.Host.Rectangle <span style="color: #804000;">0</span><span style="color: pink;">,</span><span style="color: #804000;">0</span><span style="color: pink;">,</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$bufferWidth</span> <span style="color: pink;">-</span> <span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span><span style="color: #800080;">$bufferHeight</span>
<span style="color: #800080;">$buffer</span> <span style="color: pink;">=</span> <span style="color: #800080;">$host</span>.ui.rawui.GetBufferContents<span style="color: #000000;">&#40;</span><span style="color: #800080;">$rec</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;"># Iterate through the lines in the console buffer.</span>
<span style="color: #0000FF;">for</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$i</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>; <span style="color: #800080;">$i</span> <span style="color: #FF0000;">-lt</span> <span style="color: #800080;">$bufferHeight</span>; <span style="color: #800080;">$i</span><span style="color: pink;">++</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
  <span style="color: #0000FF;">for</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$j</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>; <span style="color: #800080;">$j</span> <span style="color: #FF0000;">-lt</span> <span style="color: #800080;">$bufferWidth</span>; <span style="color: #800080;">$j</span><span style="color: pink;">++</span><span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$cell</span> <span style="color: pink;">=</span> <span style="color: #800080;">$buffer</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$i</span><span style="color: pink;">,</span><span style="color: #800080;">$j</span><span style="color: #000000;">&#93;</span>
    <span style="color: #800080;">$null</span> <span style="color: pink;">=</span> <span style="color: #800080;">$textBuilder</span>.Append<span style="color: #000000;">&#40;</span><span style="color: #800080;">$cell</span>.Character<span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#125;</span>
  <span style="color: #800080;">$null</span> <span style="color: pink;">=</span> <span style="color: #800080;">$textBuilder</span>.Append<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;<span style="color: #008080; font-weight: bold;">`r</span><span style="color: #008080; font-weight: bold;">`n</span>&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0000FF;">return</span> <span style="color: #800080;">$textBuilder</span>.ToString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">################################################################</span>
&nbsp;
<span style="color: #008000;"># Pause Script</span>
<span style="color: #0000FF;">function</span> Pause <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Message</span><span style="color: pink;">=</span><span style="color: #800000;">&quot;Script Complete. Press any key to continue...&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #008080; font-style: italic;">-NoNewLine</span> <span style="color: #800080;">$Message</span>
<span style="color: #800080;">$null</span> <span style="color: pink;">=</span> <span style="color: #000080;">$Host</span>.UI.RawUI.ReadKey<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;NoEcho,IncludeKeyDown&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;&quot;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">################################################################</span>
&nbsp;
<span style="color: #0000FF;">function</span> Get<span style="color: pink;">-</span>UserProfileConfigManager<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$siteUrl</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #008000;"># Need to get a PortalContext object</span>
<span style="color: #008000;"># as we do not have a HttpContext we need to source one the hard way</span>
<span style="color: #800080;">$site</span><span style="color: pink;">=</span><span style="color: #008080; font-weight: bold;">new-object</span> Microsoft.SharePoint.SPSite<span style="color: #000000;">&#40;</span><span style="color: #800080;">$siteUrl</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$servercontext</span><span style="color: pink;">=</span><span style="color: #000000;">&#91;</span>Microsoft.Office.Server.ServerContext<span style="color: #000000;">&#93;</span>::GetContext<span style="color: #000000;">&#40;</span><span style="color: #800080;">$site</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$site</span>.Dispose<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;"># clean up</span>
&nbsp;
<span style="color: #008000;">################################################################</span>
&nbsp;
<span style="color: #008000;"># Return the UserProfileConfigManager</span>
<span style="color: #008080; font-weight: bold;">new-object</span> Microsoft.Office.Server.UserProfiles.UserProfileConfigmanager<span style="color: #000000;">&#40;</span><span style="color: #800080;">$servercontext</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0000FF;">function</span> Get<span style="color: pink;">-</span>SPProfileManager<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$siteUrl</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #008000;"># Need to get a PortalContext object</span>
<span style="color: #008000;"># as we do not have a HttpContext we need to source one the hard way</span>
<span style="color: #800080;">$site</span><span style="color: pink;">=</span><span style="color: #008080; font-weight: bold;">new-object</span> Microsoft.SharePoint.SPSite<span style="color: #000000;">&#40;</span><span style="color: #800080;">$siteUrl</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$servercontext</span><span style="color: pink;">=</span><span style="color: #000000;">&#91;</span>Microsoft.Office.Server.ServerContext<span style="color: #000000;">&#93;</span>::GetContext<span style="color: #000000;">&#40;</span><span style="color: #800080;">$site</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$site</span>.Dispose<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;"># clean up</span>
&nbsp;
<span style="color: #008000;">################################################################</span>
&nbsp;
<span style="color: #008000;"># Return the UserProfileManager</span>
<span style="color: #008080; font-weight: bold;">new-object</span> Microsoft.Office.Server.UserProfiles.UserProfileManager<span style="color: #000000;">&#40;</span><span style="color: #800080;">$servercontext</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0000FF;">function</span> Get<span style="color: pink;">-</span>SPUserProfile<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$siteUrl</span><span style="color: pink;">,</span> <span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span> <span style="color: #800080;">$u</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$upm</span><span style="color: pink;">=</span> Get<span style="color: pink;">-</span>SPProfileManager<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$siteUrl</span><span style="color: #000000;">&#41;</span>
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$upm</span>.UserExists<span style="color: #000000;">&#40;</span><span style="color: #800080;">$u</span><span style="color: #000000;">&#41;</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$false</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #800080;">$upm</span>.CreateUserProfile<span style="color: #000000;">&#40;</span><span style="color: #800080;">$u</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$upm</span>.GetUserProfile<span style="color: #000000;">&#40;</span><span style="color: #800080;">$u</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">################################################################</span>
&nbsp;
<span style="color: #008000;"># Create function</span>
<span style="color: #0000FF;">function</span> Update<span style="color: pink;">-</span>UserProfileProperty<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0000FF;">PARAM</span>
	<span style="color: #000000;">&#40;</span>
		<span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span> <span style="color: #800080;">$siteUrl</span> <span style="color: pink;">=</span> $<span style="color: #000000;">&#40;</span> <span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;You must provide a Site Collection Url e.g. 'http://moss/'&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span>
		<span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span> <span style="color: #800080;">$userName</span> <span style="color: pink;">=</span> $<span style="color: #000000;">&#40;</span> <span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;You must provide a User Name e.g. 'DOMAINUSERNAME'&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span>
		<span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span> <span style="color: #800080;">$propName</span> <span style="color: pink;">=</span> $<span style="color: #000000;">&#40;</span> <span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;You must provide a User Profile Property Name e.g. 'WorkPhone'&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span>
		<span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span> <span style="color: #800080;">$propValue</span> <span style="color: pink;">=</span> $<span style="color: #000000;">&#40;</span> <span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;You must provide a User Profile Property Value e.g. '0400 767 022'&quot;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#41;</span>
	END
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$propValue</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;NULL&quot;</span> <span style="color: #FF0000;">-or</span> <span style="color: #800080;">$propValue</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;&quot;</span> <span style="color: #FF0000;">-or</span> <span style="color: #800080;">$propValue</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;None&quot;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Property '$propName' is not set ('$propValue')&quot;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0000FF;">else</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #800080;">$cm</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>userprofileconfigmanager <span style="color: #800080;">$siteUrl</span>
			<span style="color: #800080;">$spm</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>SPProfileManager <span style="color: #800080;">$siteUrl</span>
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$spm</span>.UserExists<span style="color: #000000;">&#40;</span><span style="color: #800080;">$userName</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #800080;">$userProfile</span> <span style="color: pink;">=</span> <span style="color: #800080;">$spm</span>.GetUserProfile<span style="color: #000000;">&#40;</span><span style="color: #800080;">$userName</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #800080;">$tempProp</span> <span style="color: pink;">=</span> <span style="color: #800080;">$spm</span>.Properties.GetPropertyByName<span style="color: #000000;">&#40;</span><span style="color: #800080;">$propName</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$tempProp</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$null</span><span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;User Profile Property '$propName' does not exist!&quot;</span>;
				<span style="color: #000000;">&#125;</span>
				<span style="color: #0000FF;">else</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #800080;">$userProfile</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$propName</span><span style="color: #000000;">&#93;</span>.Value <span style="color: pink;">=</span> <span style="color: #800080;">$propValue</span>;
					<span style="color: #800080;">$userProfile</span>.Commit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span>
				<span style="color: #008080; font-weight: bold;">write-host</span> <span style="color: #008080; font-style: italic;">-foregroundcolor</span> green <span style="color: #800000;">&quot;'$propName' User Profile Property updated to '$propValue' for '$userName'&quot;</span>
				<span style="color: #008080; font-weight: bold;">Write-Output</span> <span style="color: #800000;">&quot;'$propName' User Profile Property updated to '$propValue' for '$userName'&quot;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0000FF;">else</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #008080; font-style: italic;">-ForegroundColor</span> red  <span style="color: #800000;">&quot;User '$userName' does not exist in User Profiles!&quot;</span>
				<span style="color: #008080; font-weight: bold;">Write-output</span> <span style="color: #800000;">&quot;User '$userName' does not exist in User Profiles!&quot;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">################################################################</span>
&nbsp;
<span style="color: #0000FF;">function</span> MySiteProUpdate<span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$username</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;IBAdmin&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;IBGuest&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;IBPowerShell&quot;</span>
&nbsp;
<span style="color: #008000;"># Set MySite URL</span>
<span style="color: #800080;">$siteUrl</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;http://mysites:3000&quot;</span>
&nbsp;
<span style="color: #008000;"># Notifies</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Working... Please Wait&quot;</span>
<span style="color: #008080; font-weight: bold;">Write-Output</span> <span style="color: #800000;">&quot; &quot;</span>
&nbsp;
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$u</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$username</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
<span style="color: #008000;"># Executes command for all users in this script</span>
<span style="color: #008080; font-weight: bold;">Write-Output</span> <span style="color: #800000;">&quot;Executing this command :  Update-UserProfileProperty $siteUrl $u ActiveEmployee true&quot;</span>
Update<span style="color: pink;">-</span>UserProfileProperty <span style="color: #800080;">$siteUrl</span> <span style="color: #800000;">&quot;$u&quot;</span> <span style="color: #800000;">&quot;ActiveEmployee&quot;</span> <span style="color: #800000;">&quot;true&quot;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #008000;"># Dump Console</span>
<span style="color: #800080;">$textFileName</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;C:IBLogsConsoleDump.txt&quot;</span>
Get<span style="color: pink;">-</span>ConsoleAsText <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-file</span></span> <span style="color: #800080;">$textFileName</span> <span style="color: #008080; font-style: italic;">-encoding</span> ascii
<span style="color: #008000;">#$null = [System.Diagnostics.Process]::Start(&quot;$textFileName&quot;)</span>
pause
<span style="color: #000000;">&#125;</span>
<span style="color: #008000;">################################################################</span>
&nbsp;
MySiteProUpdate <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-File</span></span> C:IBLogsProgress.txt</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.isaacblum.com/2010/01/21/powershell-bulk-update-moss-profile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

