Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Office 365 - mass edit all users contact information

Posted on 2016-07-30
13
Medium Priority
?
331 Views
Last Modified: 2016-08-02
Experts,

I am stuck on this one.... I know i need a CSV file to complete this task and already have one.  our users are all using Office 365 and I need to edit all of their contact info properties for email signature templates (using Exclaimer).   So i need to be able to add each of my users job title, direct company phone number, email address. etc...

Ive looked online for solutions and found this:
https://www.cogmotive.com/blog/office-365-tips/update-office-365-user-details-from-a-csv-file

and I can connect perfectly fine via Power shell to connect to my Office365 account.  but thats as far as I can get.  I am not a scripting expert let me say that.  lol

I am not able create the script I need to import the data fields to populate my users account info.  I'm just lost on this one and need the assistance of someone who is familiar with how to do this.  I have about 120 users that I need to update info for and would rather not have to manually do it.

The link above helps a little but not exactly to the fields that I would need.

Thank you very much for you time and assistance
0
Comment
Question by:mkavinsky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 4
13 Comments
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 41735771
what is the header line of your csv?
0
 
LVL 16

Expert Comment

by:Todd Nelson
ID: 41735831
Are your O365 users "cloud-only" users or are the accounts syncing from your on premises AD?

The reason I ask is that it will depend on how the accounts need to be edited.  If syncing from on prem, then you cannot update the user info when connected to O365 with PowerShell.
0
 

Author Comment

by:mkavinsky
ID: 41736410
Todd,

no, my users are not cloud only (not using Azure).  I have a local on premise AD Domain Controller.

David,

The header line of my CSV is just the title of each column:
Name, Title, email, phone, department
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 41736417
Then you would use the get-aduser/set-aduser cmdlets
0
 
LVL 16

Expert Comment

by:Todd Nelson
ID: 41736450
This following reference adds new users to AD using a CSV file but updating users is essentially the same through the use of the set-aduser command.

Add Users to AD from CSV via PowerShell ... https://oddytee.wordpress.com/2015/08/12/add-users-to-ad-from-csv-via-powershell/
0
 

Author Comment

by:mkavinsky
ID: 41736478
todd

I'm not looking at add users just edit their company and contact information  - would the same still apply?
0
 

Author Comment

by:mkavinsky
ID: 41736479
david,

thank you for your response.  Sorry, but I am too savvy with the writing command line scripts.  So I am not sure how to use that line you suggested above

thanks
0
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 41736863
if the name field is indeed the samaccountname and not the display name
import-csv -path myfile.csv | set-aduser -identity $_.name   -title $_.Title -email $_.email -officephone $_.phone -Departmant $_.department 

Open in new window

https://technet.microsoft.com/en-ca/library/ee617215.aspx
0
 

Author Comment

by:mkavinsky
ID: 41737327
david,

thank you.  when I am identifying the user where you have "-identity $_.name "  am I am to use their Office 365 login (which is their email address) or their AD login name?

thanks
0
 
LVL 16

Expert Comment

by:Todd Nelson
ID: 41738036
MKavinsky,

I wasn't suggesting that you add users. The command in the article I provided as a reference is very similar to the command you will need to update users. Obviously, there are more fields that are going to be set in the following command than what you may need.

If you are syncing from your on-premises AD through AAD Connect (or DirSync or AADSync), then you have to update the users from on-premises using the Set-ADUser command; and the changes will sync to O365.

Import-Csv "C:\Users.csv" | ForEach-Object { Set-ADUser -SamAccountName $_.sAMAccountName -Department $_.Department -Company $_.Company -Fax $_.FacsimileTelephoneNumber -City $_.l -State $_.St -PostalCode $_.PostalCode -Description $_.Description -Title $_.Title }

Review the usage and parameters for Set-ADUser here ... https://technet.microsoft.com/en-us/library/ee617215.aspx


If you are not syncing from your on-premises AD through AAD Connect (or DirSync or AADSync), then you can update your O365 users via PowerShell using the the Set-MsolUser command.  The command would look similar to this for a single user…

Set-MsolUser -UserPrincipalName user1@mydomain.com -Department “My Department” -Company “My Company” -PhoneNumber “888-555-5555 -City “My City” -State “ST” -PostalCode “01234” -Description “My Description” -Title “Support Technician”

Or for users from a CSV file…

Import-Csv "C:\Users.csv" | ForEach-Object { Set-MsolUser -UserPrincipalName $_.UPN -Department $_.Department -Company $_.Company -PhoneNumber $_.PhoneNumber -City $_.City -State $_.St -PostalCode $_.PostalCode -Description $_.Description -Title $_.Title }

Review the usage and parameters for Set-MsolUser here … https://msdn.microsoft.com/en-us/library/dn194136.aspx
0
 
LVL 83

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 600 total points
ID: 41738745
thank you.  when I am identifying the user where you have "-identity $_.name "  am I am to use their
Office 365 login (which is their email address) or their AD login name?

Their samaccountname
0
 
LVL 16

Accepted Solution

by:
Todd Nelson earned 1400 total points
ID: 41738954
thank you.  when I am identifying the user where you have "-identity $_.name "  am I am to use their Office 365 login (which is their email address) or their AD login name?

It depends. If you are updating the accounts on premise you can use "identity" or "samaccountname" or "userprincipalname". If you are updating directly in O365, then you have to use "userprincipalname".
0
 

Author Closing Comment

by:mkavinsky
ID: 41739532
thank you both of your for your assistance on this.   Todd, thank you for your clarity between AD and Office365.

The help was greatly appreciated and that solution worked

thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question