20346D Powershell commands
20346D Powershell commands
- browse to this file in your virtual machine.
- copy the contents to notepad
# your organisation name <here>
# perform a find-and-replace for LucernePublishingXXXX
Lab 2A: Managing Users, Groups, and Licenses
Connect-msolservice
New-MsolUser �UserPrincipalName elabrecque@LucernePublishingXXXX.onmicrosoft.com �DisplayName
�Elisabeth Labrecque� �FirstName �Elisabeth� �LastName �Labrecque� �Password �Pa$$w0rd� �
ForceChangePassword $false �UsageLocation �CH�
New-MsolUser �UserPrincipalName lmartin@LucernePublishingXXXX.onmicrosoft.com �DisplayName
�Liane Martin� �FirstName �Liane� �LastName �Martin� �Password �Pa$$w0rd� �ForceChangePassword
$false �UsageLocation �CH�
New-MsolGroup �DisplayName �Marketing� �Description �Marketing Department users�
$MktGrp = Get-MsolGroup | Where-Object {$_.DisplayName -eq "Marketing"}
$ELabrecque = Get-MsolUser | Where-Object {$_.DisplayName -eq "Elisabeth Labrecque"}
$LMartin = Get-MsolUser | Where-Object {$_.DisplayName -eq "Liane Martin"}
Add-MsolGroupMember -GroupObjectId $MktGrp.ObjectId -GroupMemberType "User" -GroupMemberObjectId
$ELabrecque.ObjectId
Add-MsolGroupMember -GroupObjectId $MktGrp.ObjectId -GroupMemberType "User" -GroupMemberObjectId
$LMartin.ObjectId
Get-MsolGroupMember -GroupObjectId $MktGrp.ObjectId
Get-MsolUser -UnlicensedUsersOnly
Set-MsolUserLicense -UserPrincipalName elabrecque@LucernePublishingXXXX.onmicrosoft.com �
AddLicenses �LucernePublishingXXXX:ENTERPRISEPACK�
Set-MsolUserLicense -UserPrincipalName lmartin@LucernePublishingXXXX.onmicrosoft.com �
AddLicenses �LucernePublishingXXXX:ENTERPRISEPACK�
Set-MsolUser -UserPrincipalName elabrecque@LucernePublishingXXXX.onmicrosoft.com -
blockcredential $true
Remove-MsolUser �UserPrincipalName elabrecque@lucernepublishingXXXX.onmicrosoft.com �Force
Get-MsolUser �ReturnDeletedUsers
Restore-MsolUser �UserPrincipalName elabrecque@lucernepublishingXXXX.onmicrosoft.com
Get-MsolUser �ReturnDeletedUsers
Get-MsolUser
Set-MsolUser -UserPrincipalName elabrecque@LucernePublishingXXXX.onmicrosoft.com -
blockcredential $false
Lab 2B: Continue Lucerne Publishing Datacenter Setup
CD C:Temp
Set-ExecutionPolicy Unrestricted
.SetupExchange.ps1
Get-ExchangeServer | Select Name, ServerRole
Get-Mailbox -OrganizationalUnit Accounts | ft Name, Alias, ServerName, RecipientType
Import-Csv -Path e:labfileslab02O365Users.csv | ForEach-Object { New-MsolUser -
UserPrincipalName $_."UPN" -AlternateEmailAddresses $_."AltEmail" -FirstName $_."FirstName" -
LastName $_."LastName" -DisplayName $_."DisplayName" -BlockCredential $False -
ForceChangePassword $False -LicenseAssignment $_."LicenseAssignment" -Password $_."Password" -
PasswordNeverExpires $True -Title $_."Title" -Department $_."Department" -Office $_."Office" -
PhoneNumber $_."PhoneNumber" -MobilePhone $_."MobilePhone" -Fax $_."Fax" -StreetAddress
$_."StreetAddress" -City $_."City" -State $_."State" -PostalCode $_."PostalCode" -Country
$_."Country" -UsageLocation $_."UsageLocation" }
Get-MsolUser
Lab 3: Administering Office 365
Connect-msolservice
Add-MsolRoleMember �RoleName �Service Support Administrator� �RoleMemberEmailAddress
�rtorres@lucernepublishingXXXX.onmicrosoft.com�
Add-MsolRoleMember �RoleName �Billing Administrator� �RoleMemberEmailAddress
�wdouglas@lucernepublishingXXXX.onmicrosoft.com�
Add-MsolRoleMember �RoleName �Company Administrator� �RoleMemberEmailAddress
�jmuller@lucernepublishingXXXX.onmicrosoft.com�
$role = Get-MsolRole �RoleName �Service Support Administrator�
Get-MsolRoleMember �RoleObjectId $role.ObjectId
$role = Get-MsolRole �RoleName �Billing Administrator�
Get-MsolRoleMember �RoleObjectId $role.ObjectId
$role = Get-MsolRole �RoleName �Company Administrator�
Get-MsolRoleMember �RoleObjectId $role.ObjectId
Exit
Connect-msolservice
Add-MsolRoleMember �RoleName �Service Support Administrator� �RoleMemberEmailAddress
�rschmid@lucernepublishingXXXX.onmicrosoft.com�
$role = Get-MsolRole �RoleName �Service Support Administrator�
Get-MsolRoleMember �RoleObjectId $role.ObjectId
Exit
Connect-msolservice
Set-MsolPasswordPolicy -DomainName �lucernepublishingXXXX.onmicrosoft.com� �ValidityPeriod �90�
-NotificationDays �14�
Set-MsolUserPassword �UserPrincipalName �tlanctot@lucernepublishingXXXX.onmicrosoft.com� �
NewPassword �L3tme!nNow�
Get-MsolUser | Set-MsolUser �PasswordNeverExpires $false
Connect-msolservice
Import-Module aadrm
Connect-aadrmservice �Verbose
Enable-aadrm
Disconnect-aadrmservice
Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession �ConfigurationName Microsoft.Exchange �ConnectionUri
https://ps.outlook.com/powershell -Credential $UserCredential -Authentication Basic -
AllowRedirection
Import-PSSession $Session
Set-IRMConfiguration �RMSOnlineKeySharingLocation �https://sp-
rms.eu.aadrm.com/TenantManagement/ServicePartner.svc�
Import-RMSTrustedPublishingDomain -RMSOnline �name �RMS Online�
Set-IRMConfiguration -InternalLicensingEnabled $True
Test-IRMConfiguration �RMSOnline
Remove-PSSession $Session
Lab 4: Managing Clients
<Configuration>
<Add SourcePath=�LUC-SV1Office15� OfficeClientEdition=�32� >
<Product ID=�O365ProPlusRetail�>
<Language ID=�en-us� />
</Product>
<Product ID="VisioProRetail">
<Language ID="en-us" />
</Product>
</Add>
<Updates Enabled=�TRUE� UpdatePath=�LUC-SV1Office15� />
<Display Level=�None� AcceptEULA=�TRUE� />
<Logging Path=�%temp%� />
<Property Name=�AUTOACTIVATE� Value=�1� />
</Configuration>
Setup /?
setup.exe /download LUC-SV1Office15LucerneConfiguration.xml
gpupdate /force
Lab 5: Preparing for Exchange Migration
PING mail.labXXXXX.o365ready.com
PING autodiscover.labXXXXX.o365ready.com
Open mail.labXXXXX.o365ready.com 25
$Data = New-ExchangeCertificate -GenerateRequest -SubjectName "c=US,o=Lucerne Publishing,
cn=fs.labXXXXX.o365Ready.com" -DomainName
mail.labXXXXX.o365Ready.com,autodiscover.labXXXXX.o365Ready.com,labXXXXX.o365Ready.com -
PrivateKeyExportable $true
Set-Content -path "C:TempLabCertReq.txt" -Value $Data
Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path C:TempDigiCert_certscerts
fs_labXXXXX_o365ready_com.cer -Encoding byte -ReadCount 0))
$file = Get-ExchangeCertificate | Where-Object { $_.RootCAType -eq "ThirdParty" } | Export-
ExchangeCertificate -BinaryEncoded:$true -Password (Get-Credential).password
Set-Content -Path "C:TempLabcert.pfx" -Value $file.FileData -Encoding Byte
Get-ExchangeCertificate | Where-Object { $_.RootCAType -eq "ThirdParty" } | Enable-
ExchangeCertificate -Services POP,IMAP,SMTP,IIS
Lab 6: Configuring DNS Records and Migrating to Exchange Online
$enableusers = Get-User -Filter {RecipientType -eq "UserMailbox"} -OrganizationalUnit "Accounts"
$enableusers | foreach { Disable-Mailbox $_.SamAccountName }
$enableusers | foreach { Enable-MailUser $_ -externalEmailAddress $_.UserPrincipalName.toString
() }
$enableusers = Get-User -Filter {RecipientType -eq "UserMailbox"} -OrganizationalUnit "Sales"
$enableusers | foreach { Disable-Mailbox $_.SamAccountName }
$enableusers | foreach { Enable-MailUser $_ -externalEmailAddress $_.UserPrincipalName.toString
() }
Lab 7: Administering Exchange Online
Set-ExecutionPolicy unrestricted
Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession �ConfigurationName Microsoft.Exchange -ConnectionUri
https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber
Connect-MsolService �Credential $O365Cred
New-RetentionPolicyTag "Lucerne Publishing � Delete Sent Items after 90 Days" -Type SentItems -
AgeLimitForRetention 90 -RetentionAction DeleteAndAllowRecovery
Get-RetentionPolicy
Start-ManagedFolderAssistant �identity �Coralie Emond�
Start-ManagedFolderAssistant �identity �Coralie Emond�
New-MalwareFilterPolicy -Name �Internal User Policy� -action
DeleteAttachmentAndUseDefaultAlertText �EnableInternalSenderNotifications $true -
EnableInternalSenderAdminNotifications $true -InternalSenderAdminAddress
hleitner@labXXXXX.o365ready.com
New-MalwareFilterRule -Name "Lucerne Publishing - Medium Security" -MalwareFilterPolicy
"Internal User Policy" -RecipientDomainIs LabXXXXX.o365ready.com
$users = Get-Mailbox
foreach ($a in $users) {$a.emailaddresses.Add("smtp:$($a.alias)
@content.labXXXXX.o365ready.com")}
$users | %{Set-Mailbox $_.Identity -EmailAddresses $_.EmailAddresses}
New-DistributionGroup -Name "External Users" -Alias ExternalUsers -Members YourAlias, aricher -
PrimarySmtpAddress externalusers@labXXXXX.o365ready.com -Type Distribution
(
Add-RecipientPermission marketing@labXXXXX.o365ready.com -AccessRights SendAs -Trustee
lmartin@labXXXXX.o365ready.com
Get-RecipientPermission -Identity marketing@labXXXXX.o365ready.com
New-Mailbox -PrimarySmtpAddress confroomprojector@labXXXXX.o365ready.com -alias
confroomprojector -Name "Main Conference Room Projector" -equipment
Lab 8: Configuring SharePoint Online
Connect-SPOService �Url https://lucernepublishingXXXX-admin.sharepoint.com �credential
hleitner@labXXXXX.o365ready.com
New-SPOSite -Url https://lucernepublishingXXXX.sharepoint.com/sites/AcctsProj -Owner
jmuller@labXXXXX.o365ready.com -StorageQuota 500 -NoWait -Template PROJECTSITE#0 �Title
�Accounts Project�
Exit
Lab 9: Configuring Skype for Business
Import-Module LyncOnlineConnector
$Credential = Get-Credential
$session = New-CsOnlineSession -Credential $credential
Import-PSSession $session
Set-CSPrivacyConfiguration -EnablePrivacyMode $True
Set-CSPushNotificationConfiguration -EnableApplePushNotification $False
Get-CSPrivacyConfiguration
Get-CSPushNotificationConfiguration
Set-CsTenantFederationConfiguration �AllowPublicUsers $True
Set-CsTenantFederationConfiguration �AllowFederatedUsers $True
$x = New-CsEdgeDomainPattern -Domain "litware.com"
$newAllowList = New-CsEdgeAllowList -AllowedDomain $x
Set-CsTenantFederationConfiguration -AllowedDomains $newAllowList
Get-CsTenantFederationConfiguration
Remove-PSSession $session
Exit
Lab 10: Implementing Directory Synchronization
CD C:Temp
Set-ExecutionPolicy Unrestricted
.CreateProblemUsers.ps1
Set-ExecutionPolicy Unrestricted
Add-WindowsFeature NET-Framework-Core -Source C:WindowsWinSxS
Lab 11: Implementing Active Directory Federation Services
Get-ADForest
setspn -a host/fs.LabXXXXX.o365ready.com adfs-service
setspn -l adfs-service
Enable-PSRemoting �force
CD E:LabfilesLab11
.ResetPortForwarding.ps1
Set-ExecutionPolicy Unrestricted
$msolcred = Get-Credential
Connect-MsolService -Credential $msolcred
Get-MsolDomain
Set-MsolAdfsContext -Computer LUC-SV1.lucernepublishing.local
Convert-MsolDomainToFederated -DomainName LabXXXXX.O365Ready.com
Get-MsolFederationProperty -DomainName LabXXXXX.O365Ready.com
Set-ExecutionPolicy Unrestricted
Add-WindowsFeature NET-Framework-Core -Source C:WindowsWinSxS
.O365-Fed-MetaData-Update-Task-Installation.ps1
Microsoft-Office365-Update-MSOLFederatedDomain.ps1.
Get-AdfsSyncProperties
Get-AdfsSyncProperties
Set-AdfsSyncProperties -Role PrimaryComputer
Set-AdfsSyncProperties -Role SecondaryComputer -PrimaryComputerName LUC-SV2
Get-AdfsSyncProperties
Get-AdfsSyncProperties
Get-ADFSProxyProperties
Lab 12: Monitoring Office 365
No commands
Comments
Post a Comment