cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Disclaimer
JUMPCLOUD EXPRESSLY DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS, AND LIABILITIES OF ANY KIND ARISING FROM OR RELATED TO THIRD-PARTY SOFTWARE, SCRIPTS, REPOSITORIES, AND APIS. JUMPCLOUD IS NOT REQUIRED TO SUPPORT ANY SUCH THIRD-PARTY MATERIALS AND ALL RISKS RELATED TO THIRD-PARTY MATERIALS ARE YOUR RESPONSIBILITY. PLEASE ALSO REVIEW THE JUMPCLOUD TOS.

Get-JCUser and work phone and work mobile phone

dariovernelli
Novitiate III

Hi everybody,

I'd like to know if there is a way to get the work phone and work mobile phone using Get-JCUser powershell command or if I need to use another way.

Actually I'm using this script to get some data:

# Get All Users
$users = Get-JCUser
# Store all user properties + calculated "managerUsername" in a new variable called $list
$list = $users | Select-Object suspended, id, firstname, lastname, jobTitle, username, email, displayname, department, employeeIdentifier, employeeType, @{ Name = 'ManagerUsername'; Expression = { (Get-JCUser -userid $_.manager).Username } }, @{ Name = 'Manager_ID'; Expression = { (Get-JCUser -userid $_.manager).ID } }

# Export $list as a csv
$list | ConvertTo-Csv | Out-File ./users_managers_organization.csv

And I'd like to add user work phone and work mobile phone, if possible.

Thanks a lot

Dario

1 ACCEPTED SOLUTION

shawnsong
Rising Star III
Rising Star III

Thanks @urvashi for calling, so i would calculate the numbers' field like this:

 

$users =Get-JCUser
$list = $users | select @{name="mobileNum";Expression ={( $_.phoneNumbers[0].number)}},@{name="WorkNum";Expression ={( $_.phoneNumbers[1].number)}} 

feel free to concatenate the rest of the attribute you wanted to select if ^ works.  

 

View solution in original post

9 REPLIES 9

urvashi
Community Manager Community Manager
Community Manager

Hi Dario, I'm looking into this. I'll get back to you ASAP. 

urvashi
Community Manager Community Manager
Community Manager

Hi @dariovernelli phone numbers are available under

Get-JCUser -returnProperties phoneNumbers

Hope this helps ๐Ÿ™‚

Hi @urvashi ,

I'll check immediately...

Hi @urvashi,

the -returnProperties returns

{@{type=work_mobile; number=+39 1234567; _id=637d00f47419xxxxxxxxx}, @{type=work; number=+39 124234556; _id=637d00f47xxxxxxx}}

and there are the info what I'm looking for. Now I have to understand how to extract the numbers and put the expression into my query and put the results to csv.

I don't know how to use the "Expression" function...

That's where I got stuck too. @shawnsong could you help us figure out how to extract those values? 

shawnsong
Rising Star III
Rising Star III

Thanks @urvashi for calling, so i would calculate the numbers' field like this:

 

$users =Get-JCUser
$list = $users | select @{name="mobileNum";Expression ={( $_.phoneNumbers[0].number)}},@{name="WorkNum";Expression ={( $_.phoneNumbers[1].number)}} 

feel free to concatenate the rest of the attribute you wanted to select if ^ works.  

 

wow @shawnsong and @urvashi 

many many many thanks!!!! It works!!!

 

You are most welcome @dariovernelli ๐Ÿ˜‰

urvashi
Community Manager Community Manager
Community Manager

Thank you @shawnsong

You Might Like

New to the site? Take a look at these additional resources:

Community created scripts:

Our new Radical Admin blog:

Keep up with Product News:

Read our community guidelines

Ready to join us? You can register here.