Home > Software engineering >  Powershell user creation script
Powershell user creation script

Time:11-15

I have created a user creation script using powershell and everything works except the attribute "ipPhone"

Can anyone tell my why i Can't add the following line?:

$Mobile = Read-Host " xxxx " 
$ipPhone = Read-Host " xxx" 

New-ADUser -ipPhone "$ipPhone"

It works for

-Mobile "$Mobile"

But it dosent work for ipPhone? Do I need to use Set-ADuser instead?

Help with Attribute

CodePudding user response:

Cmdlet New-ADUser does not have a parameter called ipPhone.
You can set it, but then use

-OtherAttributes @{'ipPhone' = $ipPhone}

If you use Set-ADUSer, you will need to do

-replace @{'ipPhone' = $ipPhone}

CodePudding user response:

What I want it:

I am writing a script to automate user creation and one of the fields I need to edit is the ipPhone field.

The script will prompt the user to enter a value for the ipPhone and store it as a variable. But that dosent work. It works for all but ipPhone

  • Related