This blog post has been created as I have recently needed to upload hundreds of Mail Contacts into Office 365.
1. Create a CSV file which has the following columns:
ExternalEmailAddress,Name,FirstName,LastName
2. Populate the CSV file with the required contents. Name will be their Display Name, so there cannot be any spaces etc. Usually with this I will populate the FirstName & LastName and then have the following for Name:
=C2&D2
This will combine the first name and the last name and remove any spaces etc. Then just drag this down for all the users and it will populate for everyone.
3. Save this file as ImportContacts.csv
4. Open PowerShell ISE and add the following contents
(change the bold section to reflect where you've saved your ImportContacts CSV file).
#Connect To Exchange Online
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
#Function to pick the CSV File
Function Get-FileName($initialDirectory)
{
[System.Reflection.Assembly]::LoadWithPartialName(“System.windows.forms”) |
Out-Null
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.initialDirectory = $initialDirectory
$OpenFileDialog.filter = “All files (*.*)| *.*”
$OpenFileDialog.ShowDialog() | Out-Null
$OpenFileDialog.filename
} #end function Get-FileName
#Command To Launch Function and store it in the variable
$PathToCSV = Get-FileName -initialDirectory "C:\Users\adam.arkwright\Desktop\ImportContacts.csv"
#Commands to import CSV file to contacts then export the contact list for comparison
Import-Csv $PathToCSV | %{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName}
Get-MailContact | Select DisplayName,ExternalEmailAddress,FirstName,LastName | Out-GridView
Get-MailContact | Select DisplayName,ExternalEmailAddress | Export-Csv "C:\Users\adam.arkwright\Desktop\ExportedContacts.csv"
5. Save this as ImportContacts.ps1 somewhere easily accessible.
6. Open PowerShell as administrator and run ImportContacts.ps1
This will then ask you for your Office 365 Username and Password. Make sure you use the administrator credentials. If there's any issues, you may find a File Explorer windows pop up. If this happens, simply navigate to where you've saved the .csv file and double click on it. Then it will go through and start importing all the contents into your Office 365 tenant.
21 February 2017
17 February 2017
Windows 10 | Connect to wireless automatically before logging in
A client of mine had a MS Surface running Windows 10. They were almost 100% wireless and kept running into issues where they'd login to their profile and then it would connect to the wireless. That's not usually a problem, however in this case it was a roaming profile and caused some issues with connectivity.
To get around this, I was able to save the credentials prior to logging in, which allowed the Surface to connect to the Wireless before they actually go through the login process, and ensure that it has access to a Domain Controller.
Click on the 'WiFi' option from Network Settings
Select User Credentials then click Save Credentials. It will then ask you to type in a username and password which it will then use to authenticate against the wireless prior to logging in.
To get around this, I was able to save the credentials prior to logging in, which allowed the Surface to connect to the Wireless before they actually go through the login process, and ensure that it has access to a Domain Controller.
Click on the 'WiFi' option from Network Settings
Click Wireless Properties
Click Advanced Settings
Note: this isn't a scalable solution, and merely designed to get one or two users up and running on wireless devices. This will cause problems if the user's password expires as well.
For a scalable solution, you will need to use Group Policy and define a Service Account username and password.
Subscribe to:
Posts (Atom)