Import-CSV script to add mobile phone numbers to existing Active Directory accounts

Hi guys, I'm a powershell beginner and trying to make a simple script to populate the mobile phone number field for a specified number of AD accounts that are currently blank.
I have a csv file mobilenumbers2.csv with two headers, "samaccountname,mobilenumber".     Underneath the headers I would have "jdoe,3333333333" and so on.
Here is the script I tried:
import-csv .\mobilenumbers2.csv -header samaccountname,mobilenumber | ForEach-Object { set-aduser -Identity $_.samaccountname -MobilePhone $_.mobilenumb
And I'm getting this error when I tried to run it:
set-aduser : Cannot find an object with identity: 'samaccountname' under:
'DC=xxxxxxxx,DC=local'.
At C:\myscripts\addmobilephone3.ps1:1 char:88
+ ... rEach-Object { set-aduser -Identity $_.samaccountname -MobilePhone
$_.mobilenumb ...
+                   
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (samaccountname:ADUser) [Set-ADU
   ser], ADIdentityNotFoundException
    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.
   Management.ADIdentityNotFoundException,Microsoft.ActiveDirectory.Managemen 
  t.Commands.SetADUser
I can't seem to populate the "identity" switch from the csv file correctly, but if I run the command manually without importing from the csv and type "jdoe" after the identity switch it works....
Any help would be greatly appreciated,
Tom
 

Hi Tom,
If you already have the header as the first line in your csv file, plrase drop the parameter -Header, please try the script below and feedback:
import-csv .\mobilenumbers2.csv | ForEach-Object {
set-aduser -Identity $_.samaccountname -MobilePhone $_.mobilenumber}
And the input .csv file should list like:
samaccountname  mobilenumber
jdoe                     3333333333
Best Regards,
Anna

Similar Messages

  • Import vcf into Address Book loosing multiple mobile phone numbers

    When I import vcf entries that hold more than one mobile phone number, all but the first number is lost. This behavior changed from address book version 4.1.2 (osx 10.5 leopard) to address book version 5.0.1 (snow leopard - 10.6.2).
    You can try yourself:
    create an entry in the address book that has multiple mobile phone numbers, export that entry as a vcf file, delete the entry in the address book and reimport the vcf file. All but the first mobile phone number is lost! It works correct in addressbook in leopard but does not anymore in the latest version of snow leopard. I even think the error just appeard after the last update to 10.6.2!
    Apple, please fix this bug!
    regard
    Christof

    Address Book 5.0.1 multiple field issues:
    We have found the same thing. It seems to only be Address Book 5.0.1 which is affected. We are cautiously using our previous version 5.0 (from Snow Leopard 10.6.1) which seems not to be affected.
    It is also a problem if you merge records. We have found that any fields which have matching labels will be deleted leaving only one. In some cases other fields which do not match label are also deleted. We have also experienced an issue with the preferences for the formatting of Phone Numbers in the preferences dialog no longer working correctly.
    We have reported this to Apple RADAR bug reports. We have referenced this thread too.
    In the meantime our advice is to:
    Back up your Apple Address Book contacts and keep the backup safe.
    carefully use Address Book v 5.0 from Snow Leopard 10.6.1 (cautiously at your own risk as there may be issues using a version that is not designed for 10.6.2 - back up your address book first). This version has always seemed pretty reliable for us.
    If you continue to use v 5.0.1 do not merge any contacts. do not run find duplicates (just in case). do not import any contacts into the address book.
    Edward Hirst
    Equinox Features

  • Unable to call mobile phone numbers - Play mobile network - Poland

    Hi, I'm trying to call some mobile phone numbers in Poland and still got answer: "sorry you can not call this number". 2 or 3 months before it wasn't a problem but now seems that it's related only to one mobile network in Poland - Play. Do you have any idea whether they've changed their policy recently? Thank you in advance.

    I just contacted Skype support. The issue has been rosolved!!! The CALLER ID must be set up, otherwise PLAY will not accept the calls! I set up my Caller Id and suddenly was able to call all PLAY numbers! Thank you Skype for your efficient technical support!!! SKYPE RULES!!!!!

  • Getting two preordered iphones delivered today, are they specfic to the lines or will I add the phone numbers in the set up process?

    Getting two preordered iphones delivered today, are they specfic to the lines or will I add the phone numbers in the set up process?  Do I have to be careful which phone is set up for each number or doesn't it matter?

    I'd like to know the same thing, but for a slightly different reason.
    I bought one 4S using my wife's elligbility but it will be for my phone number. She will be getting my old 4.
    As I was typing this Mr. UPS just dilivered my iPhone. I made a crack to the driver if he had a few on the truck, he laughed and said he has a LOT!
    Anyway, I'm off to work. I'll try and sync it to my iTunes and see if it puts my phone number on it. If so, then I presume we can call or visit an AT&T store to have my wife's number put on my 4.

  • Powershell Active Directory Account Expiration Script

    I am putting together a script that creates a user account in AD, sets the password, adds groups, etc.  The part I am having problems with is when the user selects the Contractor employee option and is prompted for the expiration date of the AD account. 
    The script will create the account, but the expiration date is not set in AD.  Any suggestions?
    Here's the code:
    #Script to create Active Directory account
    #Add the Active Directory Module if not already present
    if (-not (Get-Module ActiveDirectory))
    Import-Module ActiveDirectory -Force
    Write-Host ""
    Write-Host "======================================================" -ForegroundColor DarkYellow
    Write-Host ""
    Write-Host "Computer Access"      
    Write-Host "Create Active Directory User Script"
    Write-Host "PowerShell 3.0"
    Write-Host "Version: 1.2"                   
    Write-Host "Date: 4/14/2014"                       
    Write-Host "Author: "
    Write-Host ""
    Write-Host "Please review the created Active Directory Account" -ForegroundColor Red -BackgroundColor Yellow
    Write-Host ""
    Write-Host "Base Business Unit Group Memberships are added only" -ForegroundColor Red -BackgroundColor Yellow
    Write-Host ""
    Write-Host "======================================================" -ForegroundColor DarkYellow
    Write-Host ""
    Write-Host ""
    Write-Host "======================================================" -ForegroundColor DarkYellow
    Write-Host "Creating Active Directory Account" -ForegroundColor Yellow
    Write-Host "======================================================" -ForegroundColor DarkYellow
    Write-Host ""
    #Specify the target OU for new users
    $targetOU = "OU=Personnel,OU=ETA,DC=eta,DC=state,DC=tx"
    #Find the current domain info
    $domdns = (Get-ADDomain).dnsroot # for UPN generation
    #Set Account Variables
    #Set Username with Dialogue Box
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "Username"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setusername=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setusername=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Please enter the username for the account:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set variable and continue
    $samname = ($setusername | Out-String)
    $samname = ($setusername) + ("")
    function validateUser
        param(
        [string]$username
        #if the username is passed without domain\
        if(($username.StartsWith("domain\")) -eq $false)
            $user = Get-ADUser -Filter { SamAccountName -eq $username }
            if (!$user)
                return $false
            else
                return $true
        elseif(($username.StartsWith("domain\")) -eq $true)
            $username = ($username.Split("\")[1])
            $user = Get-ADUser -Filter { SamAccountName -eq $username }
            if (!$user)
                return $false
            else
                return $true
    $usercheck = validateUser -username $samname
    if($userCheck -eq $true) {
    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    [Windows.Forms.MessageBox]::Show("Username already exists in AD please check and retry",`
     "Username Check", [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Stop)
    [environment]::Exit(0)
    else {} #Continue
    Write-Host ""
    Write-Host "USERNAME has been set to" $samname -ForegroundColor Yellow
    #Set User Accounts First Name
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "First Name"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setfirstname=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setfirstname=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Please enter the users first name:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set variable and continue
    $givname = ($setfirstname | Out-String)
    $givname = ("$setfirstname") + ("")
    Write-Host ""
    Write-Host "FIRST NAME has been set to" $givname -ForegroundColor Yellow
    #Set User Accounts Last Name
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "Last Name"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setlastname=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setlastname=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Please enter the users last name:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set variable and continue
    $surname = ($setlastname | Out-String)
    $surname = ("$setlastname") + ("")
    Write-Host ""
    Write-Host "LAST NAME has been set to" $surname -ForegroundColor Yellow
    #Set the Department Number for the Active Directory Account
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "Cost Center"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setcostcode=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setcostcode=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,20)
    $objLabel.Text = "Please enter the cost center for the account:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,40)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set variable and continue
    $costcode = ($setcostcode | Out-String)
    $costcode = ("$setcostcode") + ("")
    Write-Host ""
    Write-Host "COSTCODE has been set to" $costcode -ForegroundColor Yellow
    #This creates a checkbox called Employee
    $objTypeCheckbox = New-Object System.Windows.Forms.Checkbox
    $objTypeCheckbox.Location = New-Object System.Drawing.Size(10,220)
    $objTypeCheckbox.Size = New-Object System.Drawing.Size(500,20)
    $objTypeCheckbox.Text = "Employee"
    $objTypeCheckbox.TabIndex = 4
    $objForm.Controls.Add($objTypeCheckbox)
    #This creates a checkbox called Citrix User
    $objCitrixUserCheckbox = New-Object System.Windows.Forms.Checkbox
    $objCitrixUserCheckbox.Location = New-Object System.Drawing.Size(10,240)
    $objCitrixUserCheckbox.Size = New-Object System.Drawing.Size(500,20)
    $objCitrixUserCheckbox.Text = "Citrix User"
    $objCitrixUserCheckbox.TabIndex = 5
    $objForm.Controls.Add($objCitrixUserCheckbox)
    #Set Permanent or Contractor (Expiration Date)
    [void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
    [void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
    [System.Windows.Forms.Application]::EnableVisualStyles()
    $form1 = New-Object 'System.Windows.Forms.Form'
    $datetimepicker1 = New-Object 'System.Windows.Forms.DateTimePicker'
    $radiobuttonPermanent = New-Object 'System.Windows.Forms.RadioButton'
    $radiobuttonContractor = New-Object 'System.Windows.Forms.RadioButton'
    $buttonOK = New-Object 'System.Windows.Forms.Button'
    $InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
    $radiobuttonContractor_CheckedChanged={
        if($radiobuttonContractor.Checked){
            $datetimepicker1.Visible=$true
        }else{
            $datetimepicker1.Visible=$false
    $Form_StateCorrection_Load=
        #Correct the initial state of the form to prevent the .Net maximized form issue
        $form1.WindowState = $InitialFormWindowState
    $Form_Cleanup_FormClosed=
        #Remove all event handlers from the controls
        try
            $radiobuttonContractor.remove_CheckedChanged($radiobuttonContractor_CheckedChanged)
            $form1.remove_Load($FormEvent_Load)
            $form1.remove_Load($Form_StateCorrection_Load)
            $form1.remove_FormClosed($Form_Cleanup_FormClosed)
        catch [Exception]
    $form1.Controls.Add($datetimepicker1)
    $form1.Controls.Add($radiobuttonPermanent)
    $form1.Controls.Add($radiobuttonContractor)
    $form1.Controls.Add($buttonOK)
    $form1.AcceptButton = $buttonOK
    $form1.ClientSize = '508, 262'
    $form1.FormBorderStyle = 'FixedDialog'
    $form1.MaximizeBox = $False
    $form1.MinimizeBox = $False
    $form1.Name = "form1"
    $form1.StartPosition = 'CenterScreen'
    $form1.Text = "Form"
    $form1.add_Load($FormEvent_Load)
    # datetimepicker1
    $datetimepicker1.Location = '160, 91'
    $datetimepicker1.Name = "datetimepicker1"
    $datetimepicker1.Size = '200, 20'
    $datetimepicker1.TabIndex = 3
    $datetimepicker1.Visible = $False
    # radiobuttonPermanent
    $radiobuttonPermanent.Location = '33, 57'
    $radiobuttonPermanent.Name = "radiobuttonPermanent"
    $radiobuttonPermanent.Size = '104, 24'
    $radiobuttonPermanent.TabIndex = 2
    $radiobuttonPermanent.TabStop = $True
    $radiobuttonPermanent.Text = "Permanent"
    $radiobuttonPermanent.UseVisualStyleBackColor = $True
    # radiobuttonContractor
    $radiobuttonContractor.Location = '33, 87'
    $radiobuttonContractor.Name = "radiobuttonContractor"
    $radiobuttonContractor.Size = '104, 24'
    $radiobuttonContractor.TabIndex = 1
    $radiobuttonContractor.TabStop = $True
    $radiobuttonContractor.Text = "Contractor"
    $radiobuttonContractor.UseVisualStyleBackColor = $True
    $radiobuttonContractor.add_CheckedChanged($radiobuttonContractor_CheckedChanged)
    # buttonOK
    $buttonOK.Anchor = 'Bottom, Right'
    $buttonOK.DialogResult = 'OK'
    $buttonOK.Location = '421, 227'
    $buttonOK.Name = "buttonOK"
    $buttonOK.Size = '75, 23'
    $buttonOK.TabIndex = 0
    $buttonOK.Text = "OK"
    $buttonOK.UseVisualStyleBackColor = $True
    #endregion Generated Form Code
    #Save the initial state of the form
    $InitialFormWindowState = $form1.WindowState
    #Init the OnLoad event to correct the initial state of the form
    $form1.add_Load($Form_StateCorrection_Load)
    #Clean up the control events
    $form1.add_FormClosed($Form_Cleanup_FormClosed)
    #Show the Form
    $form1.ShowDialog()
    #Set the password for the new user account
    #Change P@$$w0rd to whatever you want the account password to be
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $objForm = New-Object System.Windows.Forms.Form
    $objForm.Font = New-Object System.Drawing.Font("Arial",10)
    $objForm.Text = "Password"
    $objForm.Size = New-Object System.Drawing.Size(300,200)
    $objForm.StartPosition = "CenterScreen"
    $objForm.KeyPreview = $True
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Enter")
        {$global:setpassword=$objTextBox.Text;$objForm.Close()}})
    $objForm.Add_KeyDown({if ($_.KeyCode -eq "Escape")
        {$objForm.Close()}})
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    $OKButton.Add_Click({$global:setpassword=$objTextBox.Text;$objForm.Close()})
    $objForm.Controls.Add($OKButton)
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    $CancelButton.Add_Click(
    {$Looping=$False
    $objForm.Close()
    [environment]::Exit(0)
    $objForm.Controls.Add($CancelButton)
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20)
    $objLabel.Size = New-Object System.Drawing.Size(280,40)
    $objLabel.Text = "Please enter the password you wish to set. Press Enter for P@SSw0rd:"
    $objForm.Controls.Add($objLabel)
    $objTextBox = New-Object System.Windows.Forms.TextBox
    $objTextBox.Location = New-Object System.Drawing.Size(10,60)
    $objTextBox.Size = New-Object System.Drawing.Size(260,20)
    $objForm.Controls.Add($objTextBox)
    $objForm.Topmost = $True
    $objForm.Add_Shown({$objForm.Activate(); $objTextBox.focus()})
    [void] $objForm.ShowDialog()
    #If OK then set password and continue
    $userpassword = ($setpassword | Out-String)
    $userpassword = ("$setpassword") + ("")
    if ($userpassword -eq "") {$userpassword = 'P@SSw0rd'}
    $password = (ConvertTo-SecureString $userpassword -AsPlainText -Force)
    #Set Variables for New-ADUser cmdlet
    $dplname = "$surname, $givname"
    $upname = "$givname.$surname" + "@" + "$domdns"
    $email = "$givname" + "." + "$surname" + "@eta.state.tx.us"
    $office = "WBT"
    $description = "$costcode"
    $description2 = "611IS - Permanent"
    $description3 = "611PM - Permanent"
    $description4 = "501 - Permanent"
    ##$loginscript = "yourloginscriptname"
    $servername = "teafs2"
    $homedir = "\\$($servername)\User\$($samname)"
    $homedirpath = "\\$($servername)\User\$($samname)"
    $Company= "ETA"
    $department = "yourdepartment"
    $department4 = "School Finance"
    $departmentnumber = "" + "-" + "$costcode"
    Write-Host ""
    Write-Host "HOME SERVER is" $servername -ForegroundColor Yellow
    Write-Host ""
    Write-Host "HOME DIRECTORY has been set to" $homedir -ForegroundColor Yellow
    Write-Host ""
    Write-Host "DEPARTMENT has been set to" $department -ForegroundColor Yellow
    Write-Host ""
    Write-Host "DESCRIPTION has been set to" $departmentnumber -ForegroundColor Yellow
    Write-Host ""
    #Create Active Directory Account
    New-ADUser -Name $dplname -SamAccountName $samname -DisplayName $dplname `
    -givenname $givname -surname $surname -userprincipalname $upname -emailaddress $email `
    -Path $targetou -Enabled $true -ChangePasswordAtLogon $true -Department $department `
    -OtherAttributes @{'departmentNumber'="$departmentnumber"} -Company $Company -HomeDrive "H" -HomeDirectory $homedir `
    -Description $description -Office $office -ScriptPath $loginscript -AccountPassword $password `
    #Add User to Active Directory Groups Based on Description Field
    If ((Get-ADUser $samname -Properties description).description -eq $description2) {
      Add-ADGroupMember -Identity "CN=InformationSystemsPrintGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=InformationSystemsOUDataGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=InformationSystemsNetworkAccess,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=Mail users,OU=Groups,DC=tea,DC=state,DC=tx" -Member $samname
    If ((Get-ADUser $samname -Properties description).description -eq $description3) {
      Add-ADGroupMember -Identity "CN=ProjectMgmtNetworkAccess,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=ProjectMgmtOUDataGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=ProjectMgmtPrintGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=Cognos ETASE Dev-Test-Prod,OU=Groups,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=PMO ALL,OU=Distribution Groups,OU=Mailbox accounts,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=PMO Permanent,OU=Distribution Groups,OU=Mailbox accounts,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=Mail users,OU=Groups,DC=tea,DC=state,DC=tx" -Member $samname
    If ((Get-ADUser $samname -Properties description).description -eq $description4) {
      Add-ADGroupMember -Identity "CN=SchoolFinancePrintGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=SchoolFinanceOUDataGroup,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=SchoolFinanceNetworkAccess,CN=Groups,OU=ETA,DC=tea,DC=state,DC=tx" -Member $samname
      Add-ADGroupMember -Identity "CN=Mail users,OU=Groups,DC=tea,DC=state,DC=tx" -Member $samname
    #Does the user require a mailbox?
    $mailbox = New-Object -ComObject wscript.shell
    $intAnswer = $mailbox.popup("Does this user require a mailbox?", `
    0,"Create Mailbox",32+4)
    If ($intAnswer -eq 6) {
        Add-ADGroupMember -Identity "YourADGroupName5" -Member $samname
        $mailbox.popup("User added to EMail Provisioning Group", `
        0,"Created",64+0)
    } else {
        $mailbox.popup("User has not been added to the EMail Provisioning Group", `
        0,"Not Created",64+0)
    #Does the user require a LYNC Account?
    $lyncaccount = New-Object -ComObject wscript.shell
    $intAnswer = $lyncaccount.popup("Does this user require a LYNC Account?", `
    0,"Create LYNC Account",32+4)
    If ($intAnswer -eq 6) {
        Add-ADGroupMember -Identity "YourADGroupName6" -Member $samname
        $lyncaccount.popup("User added to LYNC Provisioning Group", `
        0,"Created",64+0)
    } else {
        $lyncaccount.popup("User has not been added to the LYNC Provisioning Group", `
        0,"Not Created",64+0)
    #Create Home Directory and Set Permissions on Home Directory
    New-Item -path $homedirpath -type directory
    $acl = Get-ACL -path $homedirpath
    $permission = "yourdomainname\$($samname)","Modify","ContainerInherit,ObjectInherit","None","Allow"
    $accessrule = new-object System.Security.AccessControl.FileSystemAccessRule $permission
    $acl.SetAccessRule($accessrule)
    $acl | Set-ACL -path $homedirpath
    ##Set Share Permissions on Home Directory
    $Computer = $servername
    $Class = "Win32_Share"
    $Method = "Create"
    $name = $sharename
    $path = $sharedirpath
    $description = ""
    $sd = ([WMIClass] "\\$Computer\root\cimv2:Win32_SecurityDescriptor").CreateInstance()
    $ACE = ([WMIClass] "\\$Computer\root\cimv2:Win32_ACE").CreateInstance()
    $Trustee = ([WMIClass] "\\$Computer\root\cimv2:Win32_Trustee").CreateInstance()
    $Trustee.Name = "EVERYONE"
    $Trustee.Domain = $Null
    $Trustee.SID = @(1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0)
    $ace.AccessMask = 2032127
    $ace.AceFlags = 3
    $ace.AceType = 0
    $ACE.Trustee = $Trustee
    $sd.DACL += $ACE.psObject.baseobject
    $mc = [WmiClass]"\\$Computer\ROOT\CIMV2:$Class"
    $InParams = $mc.psbase.GetMethodParameters($Method)
    $InParams.Access = $sd
    $InParams.Description = $description
    $InParams.MaximumAllowed = $Null
    $InParams.Name = $name
    $InParams.Password = $Null
    $InParams.Path = $path
    $InParams.Type = [uint32]0
    $R = $mc.PSBase.InvokeMethod($Method, $InParams, $Null)
    switch ($($R.ReturnValue))
      0 {Write-Host "Share:$name Path:$path Result:Success"; break}
      2 {Write-Host "Share:$name Path:$path Result:Access Denied" -foregroundcolor red -backgroundcolor yellow;break}
      8 {Write-Host "Share:$name Path:$path Result:Unknown Failure" -foregroundcolor red -backgroundcolor yellow;break}
      9 {Write-Host "Share:$name Path:$path Result:Invalid Name" -foregroundcolor red -backgroundcolor yellow;break}
      10 {Write-Host "Share:$name Path:$path Result:Invalid Level" -foregroundcolor red -backgroundcolor yellow;break}
      21 {Write-Host "Share:$name Path:$path Result:Invalid Parameter" -foregroundcolor red -backgroundcolor yellow;break}
      22 {Write-Host "Share:$name Path:$path Result:Duplicate Share" -foregroundcolor red -backgroundcolor yellow;break}
      23 {Write-Host "Share:$name Path:$path Result:Reedirected Path" -foregroundcolor red -backgroundcolor yellow;break}
      24 {Write-Host "Share:$name Path:$path Result:Unknown Device or Directory" -foregroundcolor red -backgroundcolor yellow;break}
      25 {Write-Host "Share:$name Path:$path Result:Network Name Not Found" -foregroundcolor red -backgroundcolor yellow;break}
      default {Write-Host "Share:$name Path:$path Result:*** Unknown Error ***" -foregroundcolor red -backgroundcolor yellow;break}

    Would you be able to show me how it's done?
    Here's an example:
    $date = Read-Host 'Enter a date (e.g. 4/23/14)'
    Write-Host "Original string: $date"
    $dateTime = [datetime]$date
    Write-Host "DateTime object: $dateTime"
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • Re: Switching Assigned Phone numbers on existing phones

    Is there a charge at the Verizon store for switching assigned phone numbers on our current phones? I want to give my daughter my Samsung Stratosphere and take her LG Vortex (both smartphones).
    <Branched to new discussion.>
    Message was edited by: Verizon Moderator

    no. and don't let them charge you for a new SIM card either (i think your stratosphere will require a new sim card) because they are free.
    edit: i'm assuming you are on the same calling plan.

  • HT2589 I already have 2 devices on one apple ID account and want to add apple TV.  How do I add another device on an existing apple ID account so that I can download movies from the cloud to any of 3 devices?

    how do I add another device on to my apple ID account so that I can download movies etc.. from my icloud to any of the 3 devices on the account?   I already have my iphone and ipad on the account and for some reason my 3rd device (apple TV) dropped off.   If you can help, greatly appreciated!!

    Hello there, HannaGriffin.
    Since the Apple TV (1st Generation) is the only one that has storage, I would recommend the following Knowledge Base articles for troubleshooting issues with authorization:
    Apple TV (1st generation) may not play content purchased from the iTunes Store
    http://support.apple.com/kb/ts1359
    or
    Apple TV (1st generation): Apple TV repeatedly asks for password to play iTunes Store rentals or purchases
    http://support.apple.com/kb/ts2845
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro D.

  • HT4157 I'm trying to add this iPad to an existing AT&T account. I try to type in pass code, then go to the SSN & it deletes the pass code I just typed. What am I doing wrong

    I need help adding this iPad to a already existing AT&amp;T account.
    I go to type in my pass code for AT&amp;T then my SSN &amp; it then deletes my pass code ... Won't let me add it

    I have the same issue. 
    For those that that have responded to your question and don't know, you can now add your iPad to your existing AT&T data plan if you have the shared family data plan.  It's cheaper since it's only $10/month to add the device to share your data plan vice paying somthing like $30/month for 3GB (or whatever level you need).
    I was told by an AT&T employee that there are several ways to accomplish this.
    1. Call AT&T
    2. Do it online at ATT.com (I tried this but their website is down for maintenance)
    3. Do it on the iPad (which is what you and I are trying to do).
    I have no idea why after entering the passcode and then trying to enter the last 4 of your SSN that the passcode disappears.  Or conversely, if you enter the last 4 of your SSN, then go to the passcode field, that the SSN disappears.  So when you try to continue you get the please enter valid data message.  Seems like a bug in the system.

  • How do I add multiple phone numbers at once to a contact? Is there any software able to do this, which I can import to iCloud?

    I have my email forwarded to my cell phone via message to [[email protected]].
    I do this for the reason that having my emails fetched constantly is a heavy burden on the battery.
    This works perfectly, except for the fact that the emails come from a different number every time.
    The numbers change by 3 digits from 001-999. (1-210-100-###)
    I can write these numbers easily using something like excel to write the consecutive numbers, and not have to write one by one, but I would like to import these easily to my contact under "Email" for several reasons.
    1. SMS tone to be consistant
    2. Easy identification
    3. Easy deletion
    4. Message grouping
    There are probably more benefits, however I cannot think of any at this very moment.
    I want to basically write them all in to the contact to make the identity seamless.
    I've tried to do so with
    -Gmail - one number entry at a time
    -Editing the .abbu file using text editor - Cannot find the phone number location to copy and emulate
    POSSIBLE SOLUTION
    Editing the contact using excel - I downloaded "Addressbook2CSV Exporter" and managed to get the contact information in an editable form.
    I got the contact info which looks like
    [,Other","","","1210100001 ::: 1210100002","","","","","","","","Generic","","","","","","","","","","",]
    MEANING, if I can manage to merge the 999 numbers into one line of text, and add them to the numbers separated by "{space}:::{space}"
    then I have my solution right there. This may have turned from an iCloud question to an excel question.
    Any suggestions will be greatly appreciated.

    Fair enough.
    I started doing this before unlimited data and emails on phones was a common commodity, on my Samsung Blackjack.
    I then continued it due to its convenience. My only counter argument is this:
    Even when emails are set to immediately push, I am always notified earlier by this forwarding message (sometimes by several minutes/hours due to the fact that it is not dependent on my being connected to 4G or wifi to receive it.
    Also, to contradict snozdop's point that both methods use data and battery, I say this - when I use the forwarding method, the information comes in a pure text format and therefore uses considerably less information than an HTML and CSS rich email, with embedded images and such -also, unlimited text messages aids curve costs.
    I will, however, give this method a go. In any case, a solution to my original question would still be greatly appreciated.
    Thanks guys.

  • Any way (or script) to add a point-numbered footnote?

    (This is a cross-post from the Mac forum ... really need help here ... AM)
    A recent ID client who does heavy-duty legal publishing asked me this question, I didn't have an answer, but told her I'd post it here to see what the great minds have to say. (She wasn't sure she could explain it well enough.)
    They used to use Word to publish their tomes, huge loose-leaf ring binders, and moved to ID recently. They're missing an important Word feature (which may force them to abandon ID for this pub! Ack!) of being able to insert a "special" footnote that doesn't force subsequent footnotes to increment up in number.
    In other words, on a page with footnotes numberedd 15, 16, and 17, they need to be able to add a "15.1" footnote (and reference) after 15, leaving footnotes 16 and 17 etc. as is. Apparently this is a long-time practice in legal publishing. Word will continue to update all footnotes as necessary but skips the special ones, which need to be hand-updated. Not ideal, but workable.
    As far as I know, there's no way to do this in ID, nor any plug-in that will do that. (You can do this with numbered lists ... convert one of the numbered grafs to text and set the next one to start at the right number ... but not with footnotes.)
    Before you suggest that they fake it (hit a return after footnote 15 and manually enter/format a 15.1 footnote ... they've thought of that), the problem is what to do when the special footnote needs to be the first one in a list of footnotes, or the only one on a page.
    I would love to find a solution for them ... hate to see users have to move from InDesign *back* to Word!
    Edit: They're using InDesign CS4 but could use ID CS3 if necessary.

    this could be easily scripted - everything depend on the way they prepare texts
    robin
    www.adobescripts.com

  • I cannot see all mobile phone numbers in Messages after upgrade to iOS 6

    I have two mobile number entries for most of my contacts, for example:
    +853 1234 5678
    0060 853 1234 5678
    The first entry is for dialing the mobile number when I am overseas, and need to use the international prefix "+". I also use this for sending SMS messages or iMessage.
    The second entry is pre-entered to use 0060 as the international prefix when dialling long distance from my home country; this enables me to enjoy lower long-distance rates.
    I have since upgraded to iOS 6, and now have a major problem. When I go into Messages and start a new message, I cannot select the number "+853 1234 5678" to send my message. It only shows "0060 853 1234 5678", and of course, this cannot be used to send messages. This seems to me that iOS 6 is not distinguishing the above two entries as two unique numbers. In other words, the "prefix" does not count. However, if I change the "0060 853 1234 5678" to "0060 853 1234 6787", then I can see both numbers in Messages (since then, both numbers are unique).
    I have since found out through trial and error that if I list the numbers in my contacts page in the reverse order, that is:
    0060 853 1234 5678 and then
    +853 1234 5678
    then, I can see +853 1234 5678 but not the first entry. It seems that the first entry in the contact list is overriden by subsequent entries of the same mobile number.
    This was not a probem in iOS 5. Any fix for this matter in iOS 6?

    tanks for ur help. it is sms. I have contacted my service providers and they said there is no issue with my messages. so I believe something is wrong with the fone.       
    tanks

  • Add mobile phone to the system

    hello,
    i want to know if i can add a mobile number to my system UC520 as an intern number and change a free calls between them? thanks

    thank you for your response this is what i search   but can i configure cisco jabber with CCA or how can i access to the CUCM?

  • How do I take cell phone numbers off of my iCloud account.

    I have all of my devices under the same accounts, both itunes and icloud.  I originally used the smae itunes account on all my family member devices so that we could share all of our purchases.  And the same cloud account so that we can share calanders and photostream(which has been very useful). But now Im finding out that I can select my wifes or daughters phone number and receive their imessages on my phone, or my ipad, air etc...  I dont want to be tempted to read their messages and I certainly dont want them reading mine.  Is there any way to manage my icloud addresses and pull our cellular numbers off the list so that no one can read each others messages.  Ive been reading many similar posts on this forum but am surprised to find that no one else has the same problem.

    iMessage is separate from your iCloud account and does not use or even require an iCloud account.  To avoid getting each others text messages, just have everyone use a different Apple ID for iMessage (it doesn't need to be the same as thier iCloud ID).  Have your other family members go to Settings>Messages>Send & Receive on their devices, tap the ID, sign out, then sign in with separate IDs to keep everyone's text messages separated.  To avoid getting each other's FaceTime calls, have them do the same thing in Settings>FaceTime.

  • How can i add a phone to my existing itunes account

    My husband's iPhone 5C will not turn on yet I am being instructed by Apple that I must deactivate it or be charged $900 for returning it  un-deactivated. It was never added to my itunes account, so I cannot deactivate it remotely unless I add it.  How can I add it, deactivate it and add the replacement phone?  Please help as I have a very limited amount of time (and hair) left to accomplish this or be charged another $900 by apple for not returning it in a timely manner.  Thanks.

    If it won't power on, there's nothing you can do. Are they asking you to remove it from Find My iPhone? If so, and it's not associated with any account, then there's nothing to remove/deactivate.
    ~Lyssa

  • Transfer Phone Numbers Between Lines on Same Account

    Hello,
    I'm on a family plan currently with 5 lines. One of the lines is no longer used, but it's contract doesn't expire until 2014. We have another line (on the same account) that is month to month. We'd like to cancel the month to month line, but keep the phone number. Is it possible to switch the phone number we don't use with the phone number we do use and cancel the month to month line?
    I'm sorry if that sounds really confusing. Thanks for your help!

    No. The contract is associated with the phone number and can't be transferred to another line of service.

Maybe you are looking for

  • Using select list as default value in tabular form.

    Hi, I am using Application Express 4.1.0.00.32. I have two questions that are related. I have a Select item *'P1_SELECT'* and a tabular form My Items. Question 1. The My Items tabular form col1 Attributes are set Display As Text Field, and the Tabula

  • SD Pricing Procedure - Excise Values to be considered for Trading Location

    Hi Experts, We have defined a pricing procedure with PR00 condition and a Excise Condition ZTEX. While creating the Sales Order, I shall not be able to know the Excise Value (as the input Excise invoices are in the Excise module). I create a Sales or

  • Downpayment Invoice improvements

    We have identified several shortcomings in the use of the Downpayment Invoice. Firstly, if an AR Downpayment Invoice is created based on a Sales Order and the customer changes their mind and wants to reduce the lines to be delivered, the system will

  • Directory console not showing entries ???

    Hello, I just migrated around 15,000 entries into iPlanet Directory through the Import button. They went in no problem, and I could view them through the console. I then removed them using an ldif and import. I wnet back to view the entries and I not

  • Select multiple tracks to move to my ipod shuffle

    I am finding this new itunes no so intuitive as the old one.   11.0.2 I have the books of the bible on mp3 and want to put the book of Psalms on my ipod shuffle.  So I type in the search box , Psalms and i get a list of around 143 individual track ch