TechShizz | All posts tagged 'Bulk Tasks'

How to Bulk import PST files in Office 365

If migrating to Office 365 from a platform which previously used POP3, there will be a need to import all users email history into Office 365. As POP3 email is downloaded to the clients machine and this is where it all stays for the duration of it's life they traditionally get VERY BIG! In a recent migration they hav ranged from 1GB to over 30GB each.

Office 365 actually have a solutution for this, but it's not well advertised. You have to install a small client on your uploading device, log into the tenant account and then you can see the "Import" button as shown here,



Steps for Bulk PST import in Office 365

1. Populate the CSV File Provided with all of the PSTs you need to import.
O365PstImportMappingFile.csv (188B)

2. Apply the import/export permissions to the tenant account.
Excahnge GUI > Permissions > Select "Organization Management" and click Edit > Under "Roles" click on the plus symbol to "Add a role" > Select Mailbox Import Export and OK to confirm the changes.

3.Log in to the Tenant account (not as a pertner) > Import > Add > Upload files over the network
4.If not already done, Install Microsoft Azure Storage Tool with the link provided on this screen.
5. Copy the storage key and URL. KEEP THEM SAFE.
6. Start Azure Storage Tools and run:

AzCopy.exe /Source:<Source local location of PST> /Dest:"<SASURL + Folderlocation + SAS Key>" /V:AzCopylog.txt

AzCopy.exe /Source:C:\PST /Dest:"https://9b0867cef3123456659d0ed34.blob.core.windows.net/ingestiondata/PST?sv=2012-02-12&se=2016-10-09T10%3A56%3A45Z&sr=c&si=IngestionSasForAzCopy201612478032551098&sig=x5mzZ21UrIGptiVXOGl5a9A1d31PUcAFLwJjvOCOcXA%3D" /V:AzCopylog.txt

Everything in /Dest: and /DestSAS:needs to be in inverted commas

7. Once this is complete you can click next on the "Upload files over network" windows after checking the two check boxes.
8. Upload and validate the CSV file
9. Watch your PSTs import!

You can see all the details reporting from the Office 365 console including failed copies etc.

Administering Licenses in Office 365 via PowerShell

Manage user licences in Azure PowerShell

 

Remember:

connect-msolservice

 

Get-MsolaccountSku

 

Get-MsolaccountSku | Where-Object {$_.SkuPartNumber -eq "EnterprisePack"} | ForEach-Object {$_.ServiceStatus}

Get-MsolaccountSku | Where-Object {$_.SkuPartNumber -eq

 

 

List of all users

Get-MsolUser -all

 

Export list of user licences

Get-MsolUser -all | ft displayname, islicensed | Out-File "C:\UserLicences.csv"

Get Licensed users results

 

Set a users usage location (Required before assigning a licence)

Set-MsolUser -userprincipalname user@domain.local -useagelocation "GB"

 

Assign a licence to a user

Set-MsolUserLicence -userprincipalname user@domain.local -AddLicenses "TeamRou:EnterprisePack"

Assigne licenses results

 

Remove a licence from a user

Set-MsolUserLicence -userprincipalname user@domain.local -Removelicences "CBTNuggets346:EnterprisePack"

 

Remove licenses results


Disabling, Removing and Reconnecting Mailboxes

Disabling

 

Disabling a mailbox disconnects the mailbox from the user account. 

 

Disable-Mailbox

 

Removing

 

Removing a mailbox disconnects that mailbox from the user account and removes it from Active Directory

 

Remove-Mailbox

 

ReConnect

 

Go to the disconnected mailbox node, find mailbox and right click > connect > Select user account.

 

EMC:

 

Connect-Mailbox –Identity "Jesper Herp" –Database "MBX-DB-ONE" –User "Jesper Herp"

 

 

 

Get all Disconnected Mailboxes

 

$Database = Get-Mailboxdatabase

Get-Mailboxdatabase | Get-MailboxStatistics | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid

 

Take the GIUD of the mailbox to delete:

 

Remove-Mailbox -Database $Database -StoreMailboxIdentity def4aabd-2156-5857-858f-470efc3e6f28

Bulk Mailbox Creation

CSV template for this script is attached to this post named "Template.xls"

 

To create mailboxes all with the same password:

$database = Get-MailboxDatabase

$Password=Read-Host “Enter Password” –AsSecureString

 

Import-CSV CreateMailboxes.csv | ForEach {New-Mailbox -Alias $_.alias -Name $_.name -userPrincipalName $_.UPN -Database $database -OrganizationalUnit Users -Password $Password} -ResetPasswordOnNextLogon $true

 

 

To create mailboxes with custom passwords:

 

Import-CSV D:\Scripts\Bulk Mailbox Creation\users.csv | ForEach {New-Mailbox -Alias $_.alias -Name $_.name -userPrincipalName $_.UPN -Database “Mailbox Database” -OrganizationalUnit Users -Password

(ConvertTo-SecureString $_.password -AsPlainText -Force)}

Template.xlsx (10.7KB)

Creating users in Bulk with PowerShell

Finding Commands

 

Get-command *AD*

 

New-ADUser

Remove-ADUser

 

New-ADUser -Path "ou=User Accounts,dc=contoso,dc=com" -Name "Mary North"

-SAMAccountName "mary.north" -UserPrincipalName "mary.north@contoso.com"

-EmailAddress "mary.north@contoso.com" -GivenName "Mary" -Surname "North"

-Description "Sales Representative in Australia"

-Company "Contoso, Ltd." -Department "Sales"

-Office "Sydney"

 

Password Set

 

-AccountPassword (ConvertTo-SecureString -AsPlainText "Pa$$w0rd" -Force)

-ChangePasswordAtLogon $true -Enabled $true

 

Piped command

 

Get-ADUser "mary.north" | Set-ADUser -DisplayName "North, Mary"

 

Variable Command

 

$user = Get-ADUser "mary.north"

Set-ADUser $user -EmployeeNumber 12345

 

 

IMPORT FROM CSV

 

$UserList=IMPORT-CSV c:\users\administrator\documents\newusers.csv

 

# Step through Each Item in the List

 

FOREACH ($Person in $UserList) {

 

# Build Username

 

$Username=$Person.Username

 

# Build Password from Firstname and Lastname

 

$Password=$Person.Firstname+$Person.Lastname

 

# Build the Displayname

 

$Name=$Person.Firstname+” “+$Person.Lastname

 

# Build and define Domain name

 

$Domain="@teamrou.com"

 

# Build User Principal Name

 

$UPN=$Username+$Domain

 

# Build and define Home Directory path

 

$HDrive="\\Shares\%username%\"

 

# Build and define which Organizational Unit to create User inside

 

$OU="OU=test,DC=yourdomainhere,DC=com"

 

# Create Account in Active Directory (AND HERE...WE...GO!)

 

New-ADUser -Name $Name –GivenName $Person.Firstname –Surname $Person.Lastname –DisplayName $Name –SamAccountName $Username -HomeDrive "H:" -HomeDirectory $HDrive –UserPrincipalName $UPN -Path $OU

 

# Set Password

 

Set-ADAccountPassword -Identity $Username -NewPassword (ConvertTo-SecureString -AsPlainText $Password -Force)

 

# Add User to Security Groups

Add-ADPrincipalGroupMembership -Identity $Username -MemberOf "Sales","Test"

 

# Enable Account

Enable-ADAccount -Identity $Username

}