Updating UPN names in Active Directory

function OnApplicationLoad { #Note: This function is not called in Projects #Note: This function runs before the form is created #Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path #Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList) #Important: Form controls cannot be accessed in this function #TODO: Add snapins and custom code to validate the application load #Import-Module Pipeworks #Import-Module Pscx Import-Module Pipeworks

if (-not (Get-Module ActiveDirectory)){            
     Import-Module ActiveDirectory            
}            

#TODO: Place custom script here
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()            
$Script:strDomainDN = ($domain.GetDirectoryEntry()).distinguishedName 
$Script:upnDN = "cn=Partitions,cn=Configuration,$Script:strDomainDN" 

return $true #return true for success or false for failure

}

function OnApplicationExit { #Note: This function is not called in Projects #Note: This function runs after the form is closed #TODO: Add custom code to clean up and unload snapins when the application exits

$script:ExitCode = 0 #Set the exit code for the Packager

}

#endregion Application Functions

#———————————————-

Generated Form Function

#———————————————- function Call-OU_Picker_pff {

#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[void][reflection.assembly]::Load("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
[void][reflection.assembly]::Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
[void][reflection.assembly]::Load("System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
#endregion Import Assemblies

#----------------------------------------------
#region Define SAPIEN Types
#----------------------------------------------
try{
    $local:type = [ProgressBarOverlay]
}
catch
{
    Add-Type -ReferencedAssemblies ('System.Windows.Forms', 'System.Drawing') -TypeDefinition  @" 
    using System;
    using System.Windows.Forms;
    using System.Drawing;
    namespace SAPIENTypes
    {
        public class ProgressBarOverlay : System.Windows.Forms.ProgressBar
        {
            protected override void WndProc(ref Message m)
            { 
                base.WndProc(ref m);
                if (m.Msg == 0x000F)// WM_PAINT
                {
                    if (Style != System.Windows.Forms.ProgressBarStyle.Marquee || !string.IsNullOrEmpty(this.Text))
                    {
                        using (Graphics g = this.CreateGraphics())
                        {
                            using (StringFormat stringFormat = new StringFormat(StringFormatFlags.NoWrap))
                            {
                                stringFormat.Alignment = StringAlignment.Center;
                                stringFormat.LineAlignment = StringAlignment.Center;
                                if (!string.IsNullOrEmpty(this.Text))
                                    g.DrawString(this.Text, this.Font, Brushes.Black, this.ClientRectangle, stringFormat);
                                else
                                {
                                    int percent = (int)(((double)Value / (double)Maximum) * 100);
                                    g.DrawString(percent.ToString() + "%", this.Font, Brushes.Black, this.ClientRectangle, stringFormat);
                                }
                            }
                        }
                    }
                }
            }
          
            public string TextOverlay
            {
                get
                {
                    return base.Text;
                }
                set
                {
                    base.Text = value;
                    Invalidate();
                }
            }
        }
    }

“@ | Out-Null } #endregion Define SAPIEN Types

#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$formChangeUPNNames = New-Object 'System.Windows.Forms.Form'
$checkboxRecurseOUs = New-Object 'System.Windows.Forms.CheckBox'
$progressbaroverlay1 = New-Object 'SAPIENTypes.ProgressBarOverlay'
$labelNewUPNPicker = New-Object 'System.Windows.Forms.Label'
$buttonChangeUPNs = New-Object 'System.Windows.Forms.Button'
$combobox1 = New-Object 'System.Windows.Forms.ComboBox'
$buttonListOUs = New-Object 'System.Windows.Forms.Button'
$treeview1 = New-Object 'System.Windows.Forms.TreeView'
$errorprovider1 = New-Object 'System.Windows.Forms.ErrorProvider'
$imagelistButtonBusyAnimation = New-Object 'System.Windows.Forms.ImageList'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects

#----------------------------------------------
# User Generated Script
#----------------------------------------------







$formChangeUPNNames_Load={
    #TODO: Initialize Form Controls here
    Load-ComboBox $combobox1 $(Get-ADObject -Identity $Script:upnDN  -Properties upnsuffixes | select -ExpandProperty upnsuffixes)
    $errorprovider1.SetError($combobox1, "Choose UPN")
	
}



#region Control Helper Functions
function Load-ListBox 
{
<#
    .SYNOPSIS
        This functions helps you load items into a ListBox or CheckedListBox.

    .DESCRIPTION
        Use this function to dynamically load items into the ListBox control.

    .PARAMETER  ListBox
        The ListBox control you want to add items to.

    .PARAMETER  Items
        The object or objects you wish to load into the ListBox's Items collection.

    .PARAMETER  DisplayMember
        Indicates the property to display for the items in this control.
	
    .PARAMETER  Append
        Adds the item(s) to the ListBox without clearing the Items collection.
	
    .EXAMPLE
        Load-ListBox $ListBox1 "Red", "White", "Blue"
	
    .EXAMPLE
        Load-ListBox $listBox1 "Red" -Append
        Load-ListBox $listBox1 "White" -Append
        Load-ListBox $listBox1 "Blue" -Append
	
    .EXAMPLE
        Load-ListBox $listBox1 (Get-Process) "ProcessName"
#>
    Param (
        [ValidateNotNull()]
        [Parameter(Mandatory=$true)]
        [System.Windows.Forms.ListBox]$ListBox,
        [ValidateNotNull()]
        [Parameter(Mandatory=$true)]
        $Items,
        [Parameter(Mandatory=$false)]
        [string]$DisplayMember,
        [switch]$Append
    )
	
    if(-not $Append)
    {
        $listBox.Items.Clear()	
    }
	
    if($Items -is [System.Windows.Forms.ListBox+ObjectCollection])
    {
        $listBox.Items.AddRange($Items)
    }
    elseif ($Items -is [Array])
    {
        $listBox.BeginUpdate()
        foreach($obj in $Items)
        {
            $listBox.Items.Add($obj)
        }
        $listBox.EndUpdate()
    }
    else
    {
        $listBox.Items.Add($Items)	
    }

    $listBox.DisplayMember = $DisplayMember	
}

function Load-ComboBox 
{
<#
    .SYNOPSIS
        This functions helps you load items into a ComboBox.

    .DESCRIPTION
        Use this function to dynamically load items into the ComboBox control.

    .PARAMETER  ComboBox
        The ComboBox control you want to add items to.

    .PARAMETER  Items
        The object or objects you wish to load into the ComboBox's Items collection.

    .PARAMETER  DisplayMember
        Indicates the property to display for the items in this control.
	
    .PARAMETER  Append
        Adds the item(s) to the ComboBox without clearing the Items collection.
	
    .EXAMPLE
        Load-ComboBox $combobox1 "Red", "White", "Blue"
	
    .EXAMPLE
        Load-ComboBox $combobox1 "Red" -Append
        Load-ComboBox $combobox1 "White" -Append
        Load-ComboBox $combobox1 "Blue" -Append
	
    .EXAMPLE
        Load-ComboBox $combobox1 (Get-Process) "ProcessName"
#>
    Param (
        [ValidateNotNull()]
        [Parameter(Mandatory=$true)]
        [System.Windows.Forms.ComboBox]$ComboBox,
        [ValidateNotNull()]
        [Parameter(Mandatory=$true)]
        $Items,
        [Parameter(Mandatory=$false)]
        [string]$DisplayMember,
        [switch]$Append
    )
	
    if(-not $Append)
    {
        $ComboBox.Items.Clear()	
    }
	
    if($Items -is [Object[]])
    {
        $ComboBox.Items.AddRange($Items)
    }
    elseif ($Items -is [Array])
    {
        $ComboBox.BeginUpdate()
        foreach($obj in $Items)
        {
            $ComboBox.Items.Add($obj)	
        }
        $ComboBox.EndUpdate()
    }
    else
    {
        $ComboBox.Items.Add($Items)	
    }

    $ComboBox.DisplayMember = $DisplayMember	
}

function Get-CheckedNodes 
{
<#
    .SYNOPSIS
        This function collects a list of checked nodes in a TreeView

    .DESCRIPTION
        This function collects a list of checked nodes in a TreeView

    .PARAMETER  $NodeCollection
        The collection of nodes to search

    .PARAMETER  $CheckedNodes
        The ArrayList that will contain the all the checked items
	
    .EXAMPLE
        $CheckedNodes = New-Object System.Collections.ArrayList
        Get-CheckedNodes $treeview1.Nodes $CheckedNodes
        foreach($node in $CheckedNodes)
        {	
            Write-Host $node.Text
        }
#>
    param(
    [ValidateNotNull()]
    [System.Windows.Forms.TreeNodeCollection] $NodeCollection,
    [ValidateNotNull()]
    [System.Collections.ArrayList]$CheckedNodes)
	
    foreach($Node in $NodeCollection)
    {
        if($Node.Checked)
        {
            [void]$CheckedNodes.Add($Node)
        }
        Get-CheckedNodes $Node.Nodes $CheckedNodes
    }
}

#endregion



#Add-Node, get-NextLevel and Build Treeview code is taken from http://thepip3r.blogspot.nl/2011/06/powershell-guis-active-directory.html
function Add-Node { 
        param ( 
            $selectedNode, 
            $name
        ) 
        $newNode = new-object System.Windows.Forms.TreeNode  
        $newNode.Name = $name 
        $newNode.Text = $name 
        $selectedNode.Nodes.Add($newNode) | Out-Null 
        return $newNode 
} 

function Get-NextLevel {
    param (
        $selectedNode,
        [String]$dn
   )
   [System.Windows.Forms.Application]::DoEvents()
    $OUs = Get-ADObject -Filter 'ObjectClass -eq "organizationalUnit" -or ObjectClass -eq "container"' -SearchScope OneLevel -SearchBase $dn

    If ($OUs -eq $null) {
        $node = Add-Node $selectedNode $dn
    } Else {
        $node = Add-Node $selectedNode $dn
        
        $OUs | % {
            Get-NextLevel $node $_.distinguishedName
        }
    }
}
 
function Build-TreeView { 
    if ($treeNodes)  
    {  
          $treeview1.Nodes.remove($treeNodes) 
        $formChangeUPNNames.Refresh() 
    } 
    
    $treeNodes = New-Object System.Windows.Forms.TreeNode 
    $treeNodes.text = "Active Directory Root" 
    $treeNodes.Name = "Active Directory Root" 
    $treeNodes.Tag = "root" 
    $treeView1.Nodes.Add($treeNodes) | Out-Null 
     
    #$treeView1.add_AfterSelect({ 
    #    $textbox1.Text = $this.SelectedNode.Name
    #}) 
     
    #Generate Module nodes 
    $OUs = Get-NextLevel $treeNodes $Script:strDomainDN
    
    $treeNodes.Expand() 
} 
$buttonListOUs_Click={
	
	
    $progressbaroverlay1.Visible = $true
	
    $progressbaroverlay1.Style = 'Marquee'
    [System.Windows.Forms.Application]::DoEvents()
    Build-TreeView
	
    $progressbaroverlay1.Visible = $false
  
	
    #TODO: Place custom script here
	
}

$button2_Click={
	
		
    Load-ComboBox $combobox1 $(Get-ADObject -Identity $Script:upnDN  -Properties upnsuffixes | select -ExpandProperty upnsuffixes)
	
}


$buttonChangeUPNs_Click={
    #TODO: Place custom script here
    $CheckedNodes = New-Object System.Collections.ArrayList
    Get-CheckedNodes $treeview1.Nodes $CheckedNodes
        foreach($node in $CheckedNodes)
        {	
			
            If ($checkboxRecurseOUs.Checked) {
                Get-ADUser -Filter * -SearchBase "$($node.text)"  |
                    ForEach-Object {
                        $UPN = $_.UserPrincipalName -Replace '(?im)@.+$', "@$($combobox1.SelectedItem.ToString())"
                        Write-Host $UPN
                        Write-Host $_.UserPrincipalName
                        Set-ADUser $_ -UserPrincipalName $UPN 
                    }				
                $combobox1.SelectedItem
                Write-Host $node.Text
            }
		
            Else {
                Get-ADUser -Filter * -SearchBase "$($node.text)" -SearchScope OneLevel |
                    ForEach-Object {
                        $UPN = $_.UserPrincipalName -Replace '(?im)@.+$', "@$($combobox1.SelectedItem.ToString())"
                        Write-Host $UPN
                        Write-Host $_.UserPrincipalName
                        Set-ADUser $_ -UserPrincipalName $UPN 
                    }				
                $combobox1.SelectedItem
                Write-Host $node.Text
            }
        }
}


$combobox1_Validating=[System.ComponentModel.CancelEventHandler]{
#Event Argument: $_ = [System.ComponentModel.CancelEventArgs]
    #TODO: Place custom script here
	
		
}

$combobox1_Leave={
    #TODO: Place custom script here
    If ((-not $combobox1.SelectedItem) -or ($combobox1.SelectedItem.ToString() -like "")) {
            $errorprovider1.SetError($combobox1,"Select a value from the list")	
        }
        Else {
            $errorprovider1.SetError($combobox1,"")
            }
		
}

$combobox1_DropDownClosed={
    #TODO: Place custom script here
        If ((-not $combobox1.SelectedItem) -or ($combobox1.SelectedItem.ToString() -like "")) {
            $errorprovider1.SetError($combobox1,"Select a value from the list")	
        }
        Else {
            $errorprovider1.SetError($combobox1,"")
            }
}




$combobox1_TextChanged={
    #TODO: Place custom script here
    If ((-not $combobox1.SelectedItem) -or ($combobox1.SelectedItem.ToString() -like "")) {
            $errorprovider1.SetError($combobox1,"Select a value from the list")	
        }
        Else {
            $errorprovider1.SetError($combobox1,"")
            }
}

$checkboxRecurseOUs_CheckedChanged={
    #TODO: Place custom script here
	
}

# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------

$Form_StateCorrection_Load=
{
    #Correct the initial state of the form to prevent the .Net maximized form issue
    $formChangeUPNNames.WindowState = $InitialFormWindowState
}

$Form_Cleanup_FormClosed=
{
    #Remove all event handlers from the controls
    try
    {
        $checkboxRecurseOUs.remove_CheckedChanged($checkboxRecurseOUs_CheckedChanged)
        $buttonChangeUPNs.remove_Click($buttonChangeUPNs_Click)
        $combobox1.remove_TextChanged($combobox1_TextChanged)
        $combobox1.remove_Leave($combobox1_Leave)
        $combobox1.remove_Validating($combobox1_Validating)
        $buttonListOUs.remove_Click($buttonListOUs_Click)
        $formChangeUPNNames.remove_Load($formChangeUPNNames_Load)
        $formChangeUPNNames.remove_Load($Form_StateCorrection_Load)
        $formChangeUPNNames.remove_FormClosed($Form_Cleanup_FormClosed)
    }
    catch [Exception]
    { }
}
#endregion Generated Events

#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
#
# formChangeUPNNames
#
$formChangeUPNNames.Controls.Add($checkboxRecurseOUs)
$formChangeUPNNames.Controls.Add($progressbaroverlay1)
$formChangeUPNNames.Controls.Add($labelNewUPNPicker)
$formChangeUPNNames.Controls.Add($buttonChangeUPNs)
$formChangeUPNNames.Controls.Add($combobox1)
$formChangeUPNNames.Controls.Add($buttonListOUs)
$formChangeUPNNames.Controls.Add($treeview1)
$formChangeUPNNames.ClientSize = '569, 640'
$formChangeUPNNames.Name = "formChangeUPNNames"
$formChangeUPNNames.Text = "Change UPN names"
$formChangeUPNNames.add_Load($formChangeUPNNames_Load)
#
# checkboxRecurseOUs
#
$checkboxRecurseOUs.Location = '456, 569'
$checkboxRecurseOUs.Name = "checkboxRecurseOUs"
$checkboxRecurseOUs.Size = '104, 24'
$checkboxRecurseOUs.TabIndex = 9
$checkboxRecurseOUs.Text = "Recurse OU's"
$checkboxRecurseOUs.UseVisualStyleBackColor = $True
$checkboxRecurseOUs.add_CheckedChanged($checkboxRecurseOUs_CheckedChanged)
#
# progressbaroverlay1
#
$progressbaroverlay1.Location = '12, 509'
$progressbaroverlay1.Maximum = 10
$progressbaroverlay1.Name = "progressbaroverlay1"
$progressbaroverlay1.Size = '540, 23'
$progressbaroverlay1.Style = 'Marquee'
$progressbaroverlay1.TabIndex = 8
$progressbaroverlay1.TextOverlay = "Loading OU Structure"
$progressbaroverlay1.Visible = $False
#
# labelNewUPNPicker
#
$labelNewUPNPicker.Location = '14, 535'
$labelNewUPNPicker.Name = "labelNewUPNPicker"
$labelNewUPNPicker.Size = '100, 23'
$labelNewUPNPicker.TabIndex = 7
$labelNewUPNPicker.Text = "New UPN Picker"
#
# buttonChangeUPNs
#
$buttonChangeUPNs.Location = '456, 599'
$buttonChangeUPNs.Name = "buttonChangeUPNs"
$buttonChangeUPNs.Size = '96, 23'
$buttonChangeUPNs.TabIndex = 6
$buttonChangeUPNs.Text = "Change UPN's"
$buttonChangeUPNs.UseVisualStyleBackColor = $True
$buttonChangeUPNs.add_Click($buttonChangeUPNs_Click)
#
# combobox1
#
$combobox1.DropDownStyle = 'DropDownList'
$combobox1.FormattingEnabled = $True
$combobox1.Location = '14, 559'
$combobox1.Name = "combobox1"
$combobox1.Size = '165, 21'
$combobox1.TabIndex = 3
$combobox1.add_TextChanged($combobox1_TextChanged)
$combobox1.add_Leave($combobox1_Leave)
$combobox1.add_Validating($combobox1_Validating)
#
# buttonListOUs
#
$buttonListOUs.Location = '14, 599'
$buttonListOUs.Name = "buttonListOUs"
$buttonListOUs.Size = '84, 23'
$buttonListOUs.TabIndex = 1
$buttonListOUs.Text = "List OU's"
$buttonListOUs.UseVisualStyleBackColor = $True
$buttonListOUs.add_Click($buttonListOUs_Click)
#
# treeview1
#
$treeview1.CheckBoxes = $True
$treeview1.Location = '12, 27'
$treeview1.Name = "treeview1"
$treeview1.Size = '540, 478'
$treeview1.TabIndex = 0
#
# errorprovider1
#
$errorprovider1.ContainerControl = $formChangeUPNNames
#
# imagelistButtonBusyAnimation
#
$Formatter_binaryFomatter = New-Object System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
#region Binary Data
$System_IO_MemoryStream = New-Object System.IO.MemoryStream (,[byte[]][System.Convert]::FromBase64String('

AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAu MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAA ACZTeXN0ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkD AAAADwMAAAB2CgAAAk1TRnQBSQFMAgEBCAEAATABAAEwAQABEAEAARABAAT/ASEBAAj/AUIBTQE2 BwABNgMAASgDAAFAAwABMAMAAQEBAAEgBgABMP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ AP8AugADwgH/AzwB/wM8Af8DwgH/MAADwgH/A1wB/wOCAf8DwgH/sAADPAH/AwAB/wMAAf8DPAH/ MAADggH/AzwB/wM8Af8DXAH/gAADwgH/AzwB/wM8Af8DwgH/IAADPAH/AwAB/wMAAf8DPAH/A8IB /wNcAf8DggH/A8IB/xAAA8IB/wM8Af8DPAH/A8IB/wNcAf8DPAH/AzwB/wNcAf8EAAOSAf8DkgH/ A8IB/3AAAzwB/wMAAf8DAAH/AzwB/yAAA8IB/wM8Af8DPAH/A8IB/wOCAf8DPAH/AzwB/wOCAf8Q AAM8Af8DAAH/AwAB/wM8Af8DwgH/A1wB/wOCAf8DwgH/A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.ImageStream = $Formatter_binaryFomatter.Deserialize($System_IO_MemoryStream) $Formatter_binaryFomatter = $null $System_IO_MemoryStream = $null $imagelistButtonBusyAnimation.TransparentColor = ‘Transparent’ #endregion Generated Form Code

#----------------------------------------------

#Save the initial state of the form $InitialFormWindowState = $formChangeUPNNames.WindowState #Init the OnLoad event to correct the initial state of the form $formChangeUPNNames.add_Load($Form_StateCorrection_Load) #Clean up the control events $formChangeUPNNames.add_FormClosed($Form_Cleanup_FormClosed) #Show the Form return $formChangeUPNNames.ShowDialog() } #End Function #Call OnApplicationLoad to initialize if((OnApplicationLoad) -eq $true) { #Call the form Call-OU_Picker_pff | Out-Null #Perform cleanup OnApplicationExit }

comments powered by Disqus