<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Karsten Palmvig's blog : Users</title><link>http://blogs.technet.com/kpalmvig/archive/tags/Users/default.aspx</link><description>Tags: Users</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How To: Telephony enabling users - continued</title><link>http://blogs.technet.com/kpalmvig/archive/2009/07/20/how-to-telephony-enabling-users-continued.aspx</link><pubDate>Mon, 20 Jul 2009 19:49:55 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3266439</guid><dc:creator>kpalmvig</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/kpalmvig/comments/3266439.aspx</comments><wfw:commentRss>http://blogs.technet.com/kpalmvig/commentrss.aspx?PostID=3266439</wfw:commentRss><description>&lt;p&gt;It turned out to be significantly easier to find users without an assigned&amp;#160; LineURI than I expected.&amp;#160; Thanks to Nick Smith for pointing me in the right direction when answering something else. :o)&lt;/p&gt;  &lt;p&gt;The Powershell script takes no parameters and will display the primary SIP URI for all OCS enabled users without a phone number (or LineURI). The count displayed at the end is written to the host so it won’t show in the file if you redirect.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="518"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="516"&gt;         &lt;p&gt;$OCSUsers = Get-WmiObject -Query &amp;quot;Select * from MSFT_SIPESUserSetting where LineURI IS NULL&amp;quot;           &lt;br /&gt;$i=0            &lt;br /&gt;foreach ($OCSUser in $OCSUsers) {            &lt;br /&gt;&amp;#160; $OCSuser.PrimaryURI            &lt;br /&gt;&amp;#160; $i++            &lt;br /&gt;&amp;#160; }            &lt;br /&gt;Write-Host $i OCS enabled users without LineURI&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The output will be correctly formatted for use with OCSAssignTelUri.wsf&lt;/p&gt;  &lt;p&gt;Happy enabling…&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3266439" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/kpalmvig/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.technet.com/kpalmvig/archive/tags/OCS/default.aspx">OCS</category><category domain="http://blogs.technet.com/kpalmvig/archive/tags/Users/default.aspx">Users</category></item><item><title>How To: Generate multiple phone numbers when telephony enabling users</title><link>http://blogs.technet.com/kpalmvig/archive/2009/07/17/how-to-generate-multiple-phone-numbers-when-telephony-enabling-users.aspx</link><pubDate>Fri, 17 Jul 2009 16:52:53 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3265698</guid><dc:creator>kpalmvig</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/kpalmvig/comments/3265698.aspx</comments><wfw:commentRss>http://blogs.technet.com/kpalmvig/commentrss.aspx?PostID=3265698</wfw:commentRss><description>&lt;p&gt;Ever needed to generate a list of 100+ phone numbers for use with e.g. OCSAssignTelUri.wsf? I have but couldn’t be bothered with inventing a new method every time anymore, so I wrote a little ps script:&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="539"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="537"&gt;         &lt;p&gt;param ([string] $Series, [string] $Width, [string] $Count)           &lt;br /&gt;if((&amp;quot;-?&amp;quot;,&amp;quot;-help&amp;quot;,&amp;quot;-h&amp;quot;) -contains $args[0]) {            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Write-Host &amp;quot;This script will generate phone numbers based on a number series&amp;quot;            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Write-Host &amp;quot;Example: .\generatephone.ps1 -Series +1-800-555-1299 -Width 3 -Count 10&amp;quot;            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; exit 0             &lt;br /&gt;}            &lt;br /&gt;[int]$Counter = $Series.SubString($Series.Length - $Width, $Width)            &lt;br /&gt;$Base = $Series.Substring(0, $Series.Length - $Width)            &lt;br /&gt;for ($i=1; $i -le $Count; $i++) {            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [string]$strlen = $Counter            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [string]$padding = &amp;quot;&amp;quot;            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; for ($x = $strlen.Length; $x -le $Width - 1; $x++) {            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $padding = &amp;quot;0&amp;quot; + $padding            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $Number = $Base + $padding + $Counter            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Write-Output $Number            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $Counter++            &lt;br /&gt;}&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The script will take your base number series, in this case +1-800-555-1299 the width of 3 which allows the script to modify the last 3 digits and finally the count of phone numbers you need.&lt;/p&gt;  &lt;p&gt;Needless to say, there’s no error handling, so if your width goes beyond dashes you get funny results. And if you only allow editing of 2 digits with a count of 100+ – well, you do the math… :o)&lt;/p&gt;  &lt;p&gt;Anywho, just redirect the output to a file with the standard &amp;gt; operator, and Bob’s your uncle. Then you just need a file full of sip:user@domain.com, maybe a fun little project for my summer vacation to extract users without phone numbers…&lt;/p&gt;  &lt;p&gt;Enjoy…&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3265698" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/kpalmvig/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.technet.com/kpalmvig/archive/tags/OCS/default.aspx">OCS</category><category domain="http://blogs.technet.com/kpalmvig/archive/tags/Users/default.aspx">Users</category></item><item><title>How To: Bulk creation of AD users and Exchange mailboxes</title><link>http://blogs.technet.com/kpalmvig/archive/2008/03/10/how-to-bulk-creation-of-ad-users-and-exchange-mailboxes.aspx</link><pubDate>Tue, 11 Mar 2008 01:28:25 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:2985365</guid><dc:creator>kpalmvig</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/kpalmvig/comments/2985365.aspx</comments><wfw:commentRss>http://blogs.technet.com/kpalmvig/commentrss.aspx?PostID=2985365</wfw:commentRss><description>&lt;p&gt;Over the past couple of months I have worked on more than one project where the customer wanted to create a new forest for the new Exchange 2007 installation. Normally you would migrate users from the old domain(s) with ADMT or another product but in these cases brand new user accounts and mailboxes were desired.&lt;/p&gt;  &lt;p&gt;So how do you create all your new users the easiest way? Well, with Exchange Management Shell of course! :o)&lt;/p&gt;  &lt;p&gt;First you have to export existing users. Here I will use a Windows Server 2003 domain as an example source domain. I recommend using &lt;a href="http://technet2.microsoft.com/windowsserver/en/library/1050686f-3464-41af-b7e4-016ab0c4db261033.mspx?mfr=true" target="_blank"&gt;CSVDE&lt;/a&gt; for the export as it will give you a comma delimited file that is easy to manipulate in Excel. &lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;The more time you spend cleaning up your data in Excel, the more time you save later by not having to re-iterate the whole process. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Example: &lt;strong&gt;csvde &lt;/strong&gt;-d &amp;quot;ou=Domain Users,dc=contoso,dc=com&amp;quot; -f DomainUsersOU.txt&lt;/p&gt;  &lt;p&gt;Make sure your output file has the &amp;quot;.txt&amp;quot; extension for Excel to be able to detect the content properly.&lt;/p&gt;  &lt;p&gt;Now you fire up Excel, open the file and let Excel do its magic after you select comma delimited format.&lt;/p&gt;  &lt;p&gt;Select the columns and rows you want to use for the import and get rid of the rest, the example below uses just the most basic fields - you may need to import more fields; e.g. if you have OCS and phone integration you would want to keep the msRTCSIP-Line and msRTCSIP-PrimaryUserAddress fields.&lt;/p&gt;  &lt;p&gt;In this example a bunch of random passwords are created and saved in a column called &amp;quot;Password&amp;quot;.&lt;/p&gt;  &lt;p&gt;Save the file as tab delimited (this will save you a headache later) and use the following script to convert the file to a proper comma delimited format (borrowed from &lt;a href="http://msgoodies.blogspot.com/2007/04/powershell-convert-tsvtocsv.html" target="_blank"&gt;msgoodies&lt;/a&gt;):&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="479" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="477"&gt;         &lt;p&gt;$v=new-object system.text.stringBuilder 1000           &lt;br /&gt;$input | % {            &lt;br /&gt; $v.length=0 # empty sb            &lt;br /&gt; $e=$_.split(&amp;quot;`t&amp;quot;)            &lt;br /&gt; $e | % {            &lt;br /&gt;&amp;#160; $null=$v.append(&amp;quot;,&amp;quot;)            &lt;br /&gt;&amp;#160; if ($_[0] -eq &amp;quot;`&amp;quot;&amp;quot; -and $_.endswith(&amp;quot;`&amp;quot;&amp;quot;)) {            &lt;br /&gt;&amp;#160;&amp;#160; # already quoted - strip them            &lt;br /&gt;&amp;#160;&amp;#160; $_=$_.substring(1,$_.length-2)            &lt;br /&gt;&amp;#160; }            &lt;br /&gt;&amp;#160; $null=$v.append('&amp;quot;'+$_.replace('&amp;quot;','&amp;quot;&amp;quot;')+'&amp;quot;')            &lt;br /&gt; }            &lt;br /&gt; $v.tostring().substring(1)            &lt;br /&gt;}&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Save the script file as: Convert-TsvToCsv.ps1 (or really, whatever you like)&lt;/p&gt;  &lt;p&gt;Syntax for converting: &amp;quot;&lt;strong&gt;type&lt;/strong&gt; tabfile.txt | &lt;strong&gt;.\Convert-TsvToCsv.ps1&lt;/strong&gt; &amp;gt;csvfile.txt&amp;quot;&lt;/p&gt;  &lt;p&gt;Now the fun begins!&lt;/p&gt;  &lt;p&gt;Import the file into a variable by running the Import-Csv cmdlet:&lt;/p&gt;  &lt;p&gt;$users = &lt;strong&gt;Import-Csv&lt;/strong&gt; csvfile.txt&lt;/p&gt;  &lt;p&gt;This will give you a chance to verify the format of the data one last time by simply typing &amp;quot;$users&amp;quot; in the Exchange Management Shell.&lt;/p&gt;  &lt;p&gt;Now we need to parse the array of users by using a ForEach loop:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;ForEach&lt;/strong&gt; ($user in $users) { $pass = &lt;strong&gt;ConvertTo-SecureString&lt;/strong&gt; $user.Password -asPlainText -Force; &lt;strong&gt;New-Mailbox&lt;/strong&gt; -UserPrincipalName $user.userPrincipalName -Alias $user.sAMAccountName -Database $user.homeMDB -Name $user.sAMAccountName -DomainController dc01.contoso.com -OrganizationalUnit $user.ou -FirstName $user.givenName -LastName $user.sn -DisplayName $user.displayName -Password $pass -ResetPasswordOnNextLogon $true -WhatIf }&lt;/p&gt;  &lt;p&gt;The first part of the command converts the included password to a SecureString format to be able to script the input of the password. The second part creates a new AD domain account and an Exchange 2007 mailbox.&lt;/p&gt;  &lt;p&gt;Fields like &amp;quot;homeMDB&amp;quot; will of course need to be manipulated in Excel after the original export. If you use organization wide unique names for databases, you only need to specify the database name here.&lt;/p&gt;  &lt;p&gt;The &amp;quot;ou&amp;quot; will not always be populated correctly when exporting but can be derived from the &amp;quot;DN&amp;quot; field by a simple Excel macro. That is, if you want the same OU structure in the destination domain.&lt;/p&gt;  &lt;p&gt;After you have tested the script with the &amp;quot;-WhatIf&amp;quot; statement to verify success you can go ahead and remove the &amp;quot;-WhatIf&amp;quot; and create the users in your domain...&lt;/p&gt;  &lt;p&gt;Hopefully this will save you some time.... Enjoy!&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=2985365" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/kpalmvig/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.technet.com/kpalmvig/archive/tags/AD/default.aspx">AD</category><category domain="http://blogs.technet.com/kpalmvig/archive/tags/Users/default.aspx">Users</category><category domain="http://blogs.technet.com/kpalmvig/archive/tags/Exchange/default.aspx">Exchange</category></item></channel></rss>