todd klindt
play

Todd Klindt Todd.klindt@sympraxisconsulting.com @toddklindt - PowerPoint PPT Presentation

Todd Klindt Todd.klindt@sympraxisconsulting.com @toddklindt www.toddklindt.com www.toddklindt.com/MSPSUG Agenda Before you Connect Except Exchange $PSVersionTable.PSVersion Also consider adding PSReadLine if you are not on Win10


  1. Todd Klindt Todd.klindt@sympraxisconsulting.com @toddklindt www.toddklindt.com www.toddklindt.com/MSPSUG

  2. Agenda

  3. Before you Connect • Except Exchange • $PSVersionTable.PSVersion • Also consider adding PSReadLine if you are not on Win10 • Video walkthrough Install Sign-in Assistant

  4. A Word about Passwords $MyAccount = Get-Credential $username = admin@company.onmicrosoft.com $password = “ RightHereInPlainText ” $secure = $password | ConvertTo-SecureString -AsPlainText – Force $MyAccount = New-Object System.Management.Automation.PSCredential ($username, $secure) Use an encrypted file

  5. Windows Credential Manager

  6. PowerShell Use Credential Manager

  7. A Quick Word about MFA Enable MFA at the tenant (AzureAD) level Create an app password for your account

  8. Connect to your Azure AD Tenant $MyAccount = Get-PnPStoredCredential -Name TenantAdmin -Type PSCredential Connect-MsolService -Credential $MyAccount Get-MsolUSer Get-Command -Module msonline $MyAccount = Get-Credential Connect-AzureAD -Credential $MyAccount Get-AzureADUser Get-Command -Module AzureAD

  9. Fun Gotchas

  10. Don’t Try This At Home

  11. Connect to Skype for Business

  12. Exchange Online Just a little different • No cmdlets, uses Remoting • Limited to three sessions • Requires port 80 • Close out gracefully • Remove-PSSession $Session • Supports MFA

  13. License Up That New Mailbox

  14. PowerShell with SharePoint Online • Users and groups • Tenants • Site Collections • Hub Sites • Multi-Geo Download here

  15. Connect to SharePoint online

  16. Things to install Install Sign-in Assistant Install MSOnline Module Install Azure AD Module Install SharePoint Online Module Install Skype for Business Online Module Office 365 PowerShell Module Installs Update the modules

  17. Install them all

  18. Updating the Modules PowerShell to Update your PowerShell Modules

  19. Example script

  20. Real world example Param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string] $User ) # Add the Active Directory bits and not complain if they're already there Import-Module ActiveDirectory -ErrorAction SilentlyContinue # Add the Azure Active Directory module Import-Module MSOnline

  21. # Define AD group that is synced to AAD and is used for ODFB audience $syncgroupname = "CloudSync" $syncgroup = Get-ADGroup $syncgroupname # First, add the user to the group Add-ADGroupMember -Identity $syncgroupname -Members $User # Remind them to recompile their SharePoint audience Write-Host "You'll need to recompile your SharePoint audience to reflect the group change" # Sync up to Azure AD Start-ADSyncSyncCycle

  22. # Now tweak the user in Azure AD, First connect Connect-MsolService -Credential (Get- StoredCredential -Target Admin) # Azure AD domain suffix $aadsuffix = (Get-MsolDomain | Where-Object - Property IsDefault -Value $true -EQ).name # Get the user $aaduser = "$user@$aadsuffix"

  23. # Set the user's location. Without that the license will fail Set-MsolUser -UserPrincipalName $aaduser -UsageLocation “US" $license = "tkdemo:O365_BUSINESS_PREMIUM” # Set the user's license Set-MsolUserLicense -UserPrincipalName $aaduser - AddLicenses $license

  24. Microsoft Teams!! • Woo Hoo! • PowerShell Support • https://blogs.technet.microsoft.com/skypehybridguy/2017/11/07/microsoft- teams-powershell-support/ • For automating all those Teams Tasks • Install-Module MicrosoftTeams

  25. Flow and PowerApps • Flow and PowerApps • For both creators and Admins • Get list of all Flows and PowerApps • Kind of a janky install • Install-Module -Name Microsoft.PowerApps.Administration.PowerShell • Install-Module -Name Microsoft.PowerApps.PowerShell - AllowClobber

  26. Office 365/Unified Groups • No Groups module • MSOL / Azure • Exchange • Teams • PnP PowerShell

  27. The Sneaky Way: CSOM with PowerShell SharePoint 2016 Client SDK

  28. Top Of Script

  29. Get-SPOweb http://www.sharepointnutsandbolts.com/2013/12/Using-CSOM-in- PowerShell-scripts-with-Office365.html

  30. More Examples

  31. Patterns and Practices PowerShell (Phew!) Github • https://github.com/SharePoint/PnP-PowerShell

  32. Favorites • PnPFile • Set-PnPGroupPermissions • Add-PnPFile, Copy-PnPFile • Add-PnPView • Find-PnPFile, Get-PnPFile • Get-PnPField • Move-PnPFile, Remove-PnPFile • Rename-PnPFile • Restore-PnPRecycleBinItem • Set-PnPFileCheckedIn • Office 365 Groups • Set-PnPFileCheckedOut • New-PnPUnifiedGroup, Remove- • PnPList PnPUnifiedGroup • Add, Get, Set, Remove • Get-PnPUnifiedGroup, Set- • Get-PnPListItem PnPUnifiedGroup • Get-PnPUnifiedGroupMembers • Set-PnPListItem • Get-PnPUnifiedGroupOwners • Get-PnPProperty

  33. But my Boss HATES PnP PowerShell! Vesa Juvonen PowerShell Gallery RenCore • Exceptions are approved by SharePoint Engineering team • Can be more secure, as it can be more fine grained

  34. How do I keep up? https://www.toddklindt.com/POSHOffice365Modules

  35. Upload a File https://tenant.sharepoint.com/sites/hr

  36. Add a Folder Get-PnPProperty

  37. Get Internal Shared Files

  38. Get Extended File Info Connect-PnPOnline -Url $url -Credentials MeganB $doclibs = Get-PnPList -Includes DefaultViewUrl,IsSystemList | Where-Object -Property IsSystemList -EQ -Value $false | Where-Object -Property BaseType -EQ -Value "DocumentLibrary “ Foreach ($doclib in $doclibs) { $doclibTitle = $doclib.Title $docs = Get-PnPListItem -List $DocLib $docs | ForEach-Object { Get-PnPProperty -ClientObject $_ -Property File, ContentType, ComplianceInfo} foreach ($doc in $docs) { [pscustomobject]@{Library= $doclibTitle;Filename = ($doc.File).Name;ContentType = ($doc.ContentType).Name;Label = ($doc.ComplianceInfo).ComplianceTag} }

  39. Bulk Undelete Files https://sadtenant.sharepoint.com/ baduser@sadtenant.phooey https://www.toddklindt.com/PoshRestoreSPOFiles

  40. New Site and Group • No Group, No Team, No Bueno • Can be Groupified later • Group, No Team • Can be Teamified later

  41. The Whole Enchilada • There is no later!

  42. “Save Site as Template”

  43. Copy Office 365 Group Permissions

  44. https://www.toddklindt.com/PoshCopyO365GroupMembers

  45. Get All the Flows

  46. Get Your Flows

  47. Disable Flow Button Connect-SPOService -Url https://flowhater-admin.sharepoint.com $val = [Microsoft.Online.SharePoint.TenantAdministration.FlowsPolicy]::Disabled Set-SPOSite -Identity https://flowhater.sharepoint.com/sites/SadSite - DisableFlows $val Connect-PnPOnline -Url https://flowhater.sharepoint.com/sites/SadSite - Credentials ‘ SiteAdmin' Set-PnPSite -DisableFlows:$true

  48. And PowerApps Apps

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend