├── Intune ├── AAD-export-all-registered-devices-per-user.ps1 ├── DEFAULT-Import-AutopilotHashFromPpkg.ps1 ├── Intune-Delete-Stale-Devices.ps1 ├── Intune-Send-Teams-Notification.ps1 ├── Intune-UploadSptOnlineList.ps1 ├── Intune-check-stale-devices.ps1 ├── Update-Intune-Filter-Rule.ps1 ├── find-uninstall-keys.ps1 ├── graphApi │ └── community-connect-msgraph-V1.ps1 ├── intune-lastsyncdatetime-olderthan-date-to-aad-group.ps1 ├── intune-lastsyncdatetime-to-aad-group.ps1 ├── intune-list-serialnumber.ps1 ├── intune-manage-scopetags.ps1 ├── intune-msgraph-retrieve-device-info-by-serial.ps1 ├── intune-windows-autopilot-temporary-group.ps1 ├── list-local-admin-members-per-device-v2.ps1 ├── list-local-admin-members-per-device-v3.ps1 ├── list-local-admin-members-per-device.ps1 ├── macOS │ └── macos-retrieve-serialNumber.sh ├── ppkg │ ├── CMTrace.exe │ ├── Import-AutopilotHash.ps1 │ ├── create-vm-hyperv.ps1 │ ├── get-windowsautopilotinfo.ps1 │ ├── get-windowsautopilotinfocommunity.ps1 │ ├── locationidv2.txt │ └── register-autopilot.ps1 └── proactive remediation │ ├── contoso-device-name-standard │ ├── contoso-device-name-standard-detection.ps1 │ └── contoso-device-name-standard-remediation.ps1 │ ├── contoso-recover-local-admin │ ├── detect-create-localadmin.ps1 │ └── remediate-create-localadmin.ps1 │ ├── detect and copy outlook template files │ ├── detection-sync-outlook-template-multiple-files.ps1 │ ├── detection-sync-outlook-template-single-file.ps1 │ ├── image1.png │ ├── remediation-sync-outlook-template-multiple-files.ps1 │ └── remediation-sync-outlook-template-single-file.ps1 │ └── detect and remove drawio │ ├── detect-drawio.ps1 │ └── remediate-drawio.ps1 └── Other ├── 0 ├── CMTrace.exe ├── autopilot-reg.ps1 ├── community-graph-api-v31.ps1 ├── get-windowsautopilotinfo.ps1 ├── get-windowsautopilotinfocommunity.ps1 └── working-dir.ps1 ├── 1 ├── 1 - Read domain list from CSV and export email domain data.docx ├── get-windowsautopilotinfo.ps1 ├── import-csv-search-for-email-domains.ps1 └── readme.md ├── 2 ├── 2 - List ADDS (active directory domain services) account summary.docx ├── adds-users-count.ps1 └── readme.md ├── 3 ├── 3 - Office365 - Assign ATP licenses from a file.docx ├── media │ ├── 5a6495ec575c28d7e99b2a3a27e9ba04.png │ └── 6aa116cf97f5e143ce45ee8f485d9f67.png ├── o365-assign-atp-licenses.ps1 └── readme.md ├── 4 ├── 4 - Add members to a Distribution List (DL) from a CSV file.docx ├── add-members-to-dl01.csv ├── media │ ├── 0912dbc29f3155b006bbd2c653060620.png │ ├── 10655b597b5bf332e2e65413aada3859.png │ ├── 161dad7b0db9361a0b98ab772a5df58c.png │ └── cb2742bf953a876c67a29f85b542ec6e.png ├── o365-add-members-to-dl-from-csv.ps1 └── readme.md ├── 5 ├── 5 - Create a Distribution List (DL) from CSV on Office 365.docx ├── O365-create-dl-from-csv.ps1 ├── create-dl.csv ├── media │ ├── 99d72939e87113c8aed6959980dc11a2.png │ ├── b5ede4ca5c29a1b1eba72555ac9d1af9.png │ └── b82cbecad38018c10d36e5e3dfb03d84.png └── readme.md ├── 6 ├── 6 - Export Office365 User Roles to CSV (Admin Roles).docx ├── Export Office365 User Roles to CSV.ps1 └── readme.md ├── 7 ├── 7 - Monitor DFS backlog and Send email notification.docx ├── check-DFS-replicationv3.ps1 └── readme.md ├── 8 ├── 8 - Generate Random Password (ADDS & Azure AD Office365).docx ├── Randon-Password-Generator-v1.ps1 ├── media │ └── 9604766ecd48d2e25365819334865835.png └── readme.md ├── 9 ├── 9 - Retrieve all Office365 users and compare their displayname with ADDS.docx ├── check-msoluser-adds.ps1 ├── media │ ├── 02b09a16a56d8ffa5781b8d997e06d5b.png │ └── 82de3df25159236992250466fe97845a.png └── readme.md ├── 10 ├── 10 - Monitor a folder size on real-time every hour.docx ├── monitor-folder-size.ps1 └── readme.md ├── 11 ├── 11 - ADFS - Export.docx ├── export-adfs-relyingpartytrust-issuancetransformrules.ps1 ├── media │ └── 8864ecc17598dda58b7cb96db293f622.png └── readme.md ├── 12 ├── 12 - Creates a Standard User for ADDS and Office365 Management.docx ├── create-defaul-user-adds-o365-v1.1.ps1 ├── media │ ├── 08ade24a2e2cbf8418b00970c6cda5b0.jpg │ ├── 6c7fc23622588e40946ffc4c0096e699.jpg │ └── ea7e7d13f200a57df00c069f9f9b38f6.jpg └── readme.md ├── 13 ├── 13 - Retrieve all Office365 users and compare their UPN (userprincipalname) with ADDS.docx ├── check-msoluser-adds-upn.ps1 ├── media │ ├── 1de63d04039b5e3715995530f7886f13.png │ └── 80bd1c9728c717fafeebdea9b1f752cc.png └── readme.md ├── 14 ├── 14 - Configure your 1st ADDS Server.docx ├── 1st-server-ADDS.ps1 └── readme.md ├── 15 ├── 15 - Office365, Exchange, SharePoint and Skype For Business Powershell Profile Script.docx ├── Microsoft.PowerShell_profile.ps1 ├── media │ └── d961b416f5f01948d8671d9f910b026c.png └── readme.md ├── 16 ├── 16 - Export All Distribution Lists Information and its members to CSV.docx ├── o365-export-DL-v1.ps1 └── readme.md ├── 17 ├── 17 - Check if a DL (Distribution List) exists on Office 365.docx ├── O365-check-DL-group-exists-v1.ps1 └── readme.md ├── 18 ├── 18 - Office365 & Azure Powershell Management Functions.docx ├── Microsoft.PowerShell_profile (1).ps1 └── readme.md ├── 19 ├── 19 - SCCM Inventory and Assessment Scripts.docx ├── readme.md └── sccm-exports.zip ├── 20 ├── 20 - Check ADDS attributes (email, proxysmtpaddresses).docx ├── check-adds-attributes.zip ├── media │ ├── 1966bc0028180a3149d72046727050e9.png │ └── c8a892004ff8f332e363383d0474a277.png └── readme.md ├── 21 ├── 21 - Hyperv-VMM-2012R2-UpdateKBList.docx ├── WS2012R2HypervVMMupdateList.zip ├── readme.md └── urls.txt ├── 22 ├── 22 - SCCM inventory & assessment.docx ├── readme.md └── sccm-exports (1).zip ├── 23 ├── 23 - Export SCCM apps, task sequence, collections, queries and packages.docx ├── media │ ├── 87b509c0498746a736c9d98bc5efcb91.png │ └── ed54e64edb5ed282c615e33cedf4aedf.png ├── readme.md └── sccm-export-scripts.zip ├── 24 ├── 24.docx └── readme.md ├── 25 ├── connect-o365-win-server.ps1 ├── connect-o365-win10.ps1 └── readme.md ├── 26 ├── readme.md └── remove-user-from-a-team.ps1 ├── 27 ├── blog-check-group-allow-create-teams-membership.ps1 └── readme.md ├── 28 ├── Office 365 – Exporting Shared Mailbox Permissions to CSV.ps1 ├── THEBEIER-NonOwnerPermissions-filtered.xlsx ├── THEBEIER-NonOwnerPermissions.csv ├── media │ ├── 191e03585a70fe9e2d55b9a500331e83.png │ └── 5247f976b00076a69dcce662205faeda.png └── readme.md ├── 29 ├── external-contacts.csv ├── media │ └── 2afb5613639afff857ef79b10f7dc03f.png └── readme.md ├── 30 ├── dgroups-members.csv ├── media │ └── 176e27daadfcd681bdde9785a6cfed5e.png └── readme.md ├── README.md └── TPG ├── DEV_PPKG_CREG.ppkg ├── DEV_PPKG_Default.ppkg ├── Project_2.ppkg ├── TPG-importHash.ppkg └── get-windowsautopilotinfocommunity.ps1 /Intune/AAD-export-all-registered-devices-per-user.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all user registered devices Azure AD (AAD) per user and export to local path. 4 | 5 | .DESCRIPTION 6 | This script retrieve all user registered devices Azure AD (AAD) per user. 7 | Used to identify devices and work on a cleanup 8 | Export file name format: all-registered-aad-devicesv-$dt.csv 9 | 10 | .NOTES 11 | Fixed the 100-device return limitation '-All' 12 | Original post https://morgantechspace.com/2019/06/get-azure-ad-users-with-registered-devices-powershell.html 13 | 14 | .AUTHOR 15 | Author: Thiago Beier 16 | Email: thiago.beier@gmail.com 17 | Blog: https://thebeier.com 18 | LinkedIn: https://www.linkedin.com/in/tbeier/ 19 | Twitter: https://twitter.com/thiagobeier 20 | Date: 04/05/2023 21 | Version: 1.0 22 | #> 23 | 24 | #Date and time 25 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 26 | 27 | # 28 | 29 | $Result=@() 30 | $Users = Get-AzureADUser -All $true | Select UserPrincipalName,ObjectId 31 | $Users | ForEach-Object { 32 | $user = $_ 33 | Get-AzureADUserRegisteredDevice -All $true -ObjectId $user.ObjectId | ForEach-Object { 34 | $Result += New-Object PSObject -property @{ 35 | DeviceOwner = $user.UserPrincipalName 36 | DeviceName = $_.DisplayName 37 | DeviceOSType = $_.DeviceOSType 38 | ApproximateLastLogonTimeStamp = $_.ApproximateLastLogonTimeStamp 39 | } 40 | } 41 | } 42 | 43 | #Export 44 | $Export = $Result | Select DeviceOwner,DeviceName,DeviceOSType,ApproximateLastLogonTimeStamp 45 | $Export | export-csv all-registered-aad-devicesv-$dt.csv -NoTypeInformation -Encoding utf8 -Append 46 | -------------------------------------------------------------------------------- /Intune/Intune-Delete-Stale-Devices.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all devices from Intune that have Azure AD Device Id as null / 00000000-0000-0000-0000-000000000000 4 | 5 | .DESCRIPTION 6 | This script checks for stale devices in Intune and delete them all from Intune 7 | 8 | .NOTES 9 | Author: Thiago Beier 10 | Email: thiago.beier@gmail.com 11 | Blog: https://thebeier.com 12 | LinkedIn: https://www.linkedin.com/in/tbeier/ 13 | Twitter: https://twitter.com/thiagobeier 14 | Date: 03/09/2023 15 | Version: 1.0 16 | 17 | #> 18 | 19 | # Date and Time 20 | $date = Get-Date -Format "yyyy-MM-dd" 21 | $fulldate = $date 22 | $fulldate.Split("-") 23 | $dtyear = $fulldate.Split("-")[0] 24 | $dtmonth = $fulldate.Split("-")[1] 25 | $dtday = $fulldate.Split("-")[2] 26 | $workdir = "c:\temp\$dtyear\$dtmonth\$dtday" 27 | 28 | #Test to see if folder [$LogFolder] exists" 29 | if (Test-Path -Path $workdir) { 30 | "Working dir folder exists!" 31 | } 32 | else { 33 | "Working dir folder doesn't exist. Creating." 34 | New-Item -ItemType Directory -Path $workdir 35 | } 36 | set-location $workdir 37 | 38 | # Log folder and Transcript 39 | $LogFolder = "$workdir" 40 | $mainlogfile = $LogFolder + "\" + $logfile 41 | 42 | Start-Transcript -Path $mainlogfile 43 | 44 | # 45 | Connect-MSGraph 46 | 47 | $Devices = Get-IntuneManagedDevice -Filter "contains(operatingsystem, 'Windows')" | Get-MSGraphAllPages 48 | 49 | $Devices | Where-Object {$_.azureADDeviceId -eq "00000000-0000-0000-0000-000000000000"} | Select-Object deviceName,serialnumber,userprincipalname,id | export-csv -NoTypeInformation -Encoding utf8 Intune-Stale-Devices-$dt.csv -Append 50 | 51 | $Devices | Where-Object {$_.azureADDeviceId -eq "00000000-0000-0000-0000-000000000000"} | ForEach-Object { 52 | "Working on Device: $($_.devicename)" 53 | Remove-IntuneManagedDevice -managedDeviceId $_.id 54 | } 55 | 56 | stop-transcript 57 | 58 | -------------------------------------------------------------------------------- /Intune/Intune-Send-Teams-Notification.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script sends a notification (HTML format table) to a specific Teams Channel 4 | 5 | .DESCRIPTION 6 | This script requires Teams Channel, a Connect (webhook) and a few variables self-explained in the code 7 | 8 | .NOTES 9 | Author: Thiago Beier 10 | Email: thiago.beier@gmail.com 11 | Blog: https://thebeier.com 12 | LinkedIn: https://www.linkedin.com/in/tbeier/ 13 | Twitter: https://twitter.com/thiagobeier 14 | Date: 03/10/2023 15 | Version: 1.1 - replaced previous invoke by Invoke-RestMethod 16 | #> 17 | 18 | # Functions 19 | # Function to send notificaton to teams 20 | #Date and time 21 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 22 | 23 | #variable to test the html webhook 24 | 25 | $session = New-CimSession 26 | $serial = (Get-CimInstance -CimSession $session -Class Win32_BIOS).SerialNumber 27 | 28 | $env:COMPUTERNAME 29 | $tmpgrouptag = "EMPTY" 30 | $groupTag = "CONTOSO" 31 | 32 | function SendTeamsNotification { 33 | #sending end-user toast notification 34 | Write-Output 'sending end-user toast notification' 35 | 36 | $payload = @{ 37 | "channel" = "#general" 38 | #"text" = "Alert!!! New Windows Autopilot Device Name: $env:COMPUTERNAME added to Location: $grouptag " 39 | "text" = "

Alert


Current Device NameCurrent Location codeDate & TimeSERIALNew Location code
$env:COMPUTERNAME$($tmpgrouptag)$dt$serial$groupTag
" 40 | } 41 | 42 | #then we invoke web request using the uri which is the Teamswebhook url alongside the post method to send our request 43 | $myTeamsWebHook = "https://YOURTENANTNAME.webhook.office.com/webhookb2/xxxxxxx@yyyyyyyyy/IncomingWebhook/c88bf2bcfa8e498e9d67bfe192cf9a58/zzzzzzzzz" 44 | Invoke-RestMethod -Method post -ContentType 'Application/Json' -Body (ConvertTo-Json -Compress -InputObject $payload) -Uri $myTeamsWebHook 45 | Write-Output "The condition was true" 46 | } 47 | # Function to upload imported / updated devices to SharePoint List 48 | 49 | SendTeamsNotification 50 | 51 | -------------------------------------------------------------------------------- /Intune/Intune-UploadSptOnlineList.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script uploads in this scenario autopilot enrollment status to SharePoint List (keeps history: device name, date & time, location code (OrderID / GroupTag) 4 | 5 | .DESCRIPTION 6 | This is customized for Intune Import Hash to Windows Autopilot Devices 7 | This script uploads in this scenario autopilot enrollment status to SharePoint List (keeps history: device name, date & time, location code (OrderID / GroupTag) 8 | 9 | .NOTES 10 | Author: Thiago Beier 11 | Email: thiago.beier@gmail.com 12 | Blog: https://thebeier.com 13 | LinkedIn: https://www.linkedin.com/in/tbeier/ 14 | Twitter: https://twitter.com/thiagobeier 15 | Date: 03/24/2023 16 | Version: 1.0 17 | #> 18 | 19 | # Functions 20 | 21 | function UploadSPTList { 22 | #TLS 23 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 24 | 25 | # Install powershell module 26 | if (-not (Get-Module PnP.PowerShell -ListAvailable)) { 27 | Install-Module -Name "PnP.PowerShell" -Force -Confirm:$false 28 | } 29 | 30 | #Urls 31 | $siteUrl = "https://UPDATE-TO-YOUR-TENANTNAME.sharepoint.com/sites/Contoso" #please update to your TENANT NAME 32 | $site = Connect-PnPOnline -ClientId $AppId -Url $siteUrl -Tenant $($aadtenantname.onmicrosoft.com) -CertificatePath '.\PnPPowerShell.pfx' #Requires Azure AD Application using self-signed certificate 33 | 34 | # Get Context 35 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 36 | $clientContext = Get-PnPContext 37 | $targetWeb = Get-PnPWeb 38 | 39 | # Get the list object 40 | $targetList = $targetWeb.Lists.GetByTitle("Autopilot") 41 | $clientContext.Load($targetList) 42 | $clientContext.ExecuteQuery() 43 | 44 | # Get the fields object. List all the columns separated with comma 45 | $fields = "Id", "Title", "LocationCode", "Serial", "DateTime", "NewLocationCode" 46 | $ListItems = Get-PnPListItem -List $targetList -Fields $fields 47 | foreach ($ListItem in $ListItems) { 48 | Write-Host "Item Id : " $ListItem["ID"] "Item Title : " $ListItem["Title"] "Item LocationCode : " $ListItem["LocationCode"] "Item Serial : " $ListItem["Serial"] "Item DateTime : " $ListItem["DateTime"] "Item NewLocationCode : " $ListItem["NewLocationCode"] 49 | } 50 | 51 | #uncomment block below to validate variables 52 | #$env:COMPUTERNAME 53 | #$($grouptag) 54 | #$dt 55 | #$serial 56 | #$grouptag 57 | 58 | #upload values to SPT online list // List name: Autopilot (case sensitive) 59 | Add-PnPListItem -List "Autopilot" -Values @{ 60 | "Title" = $env:COMPUTERNAME ; 61 | "LocationCode" = $($temp.groupTag); 62 | "DateTime" = $dt; 63 | "Serial" = $serial; 64 | "NewLocationCode" = $grouptag; 65 | } 66 | 67 | } 68 | 69 | # Generate Access Token to use in the connection string to MSGraph 70 | $AppId = 'YOUR-AZURE-AD-APP-ID' 71 | $TenantId = 'YOUR-TENANT-ID' 72 | $AppSecret = 'YOUR-AZURE-AD-APP-ID-SECRET' 73 | $GroupTag = "" #Location code for any company or BLANK for Hybrid Azure AD Default 74 | $aadtenantname = 'YOUR-TENANT-NAME' 75 | 76 | 77 | # Powershell Modules 78 | #"Installing Packages" 79 | #Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Confirm:$false -Force:$true 80 | #Install-Script get-windowsautopilotinfo -Confirm:$false -Force:$true 81 | #Install-Module -Name Microsoft.Graph.Intune -Confirm:$false -Force:$true 82 | #Install-Module -Name WindowsAutoPilotIntune -Confirm:$false -Force:$true 83 | 84 | # Your Code here 85 | # Start-Transcript 86 | 87 | # Where $($temp.groupTag) variable is part of Intune Autopilot enrollment / import hash script as part of this post https://thiagobeier.wordpress.com/2023/03/21/enroll-windows-device-using-ppkg/ 88 | 89 | # Stop-Transcript 90 | 91 | #Update SharePoint List 92 | UploadSPTList -------------------------------------------------------------------------------- /Intune/Intune-check-stale-devices.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all devices from Intune that have Azure AD Device Id as null / 00000000-0000-0000-0000-000000000000 4 | 5 | .DESCRIPTION 6 | This script checks for stale devices in Intune 7 | 8 | .NOTES 9 | Author: Thiago Beier 10 | Email: thiago.beier@gmail.com 11 | Blog: https://thebeier.com 12 | LinkedIn: https://www.linkedin.com/in/tbeier/ 13 | Twitter: https://twitter.com/thiagobeier 14 | Date: 03/09/2023 15 | Version: 1.0 16 | 17 | #> 18 | 19 | Connect-MSGraph 20 | $Devices = Get-IntuneManagedDevice -Filter "contains(operatingsystem, 'Windows')" | Get-MSGraphAllPages 21 | $Devices 22 | $Devices | Where-Object {$_azureADDeviceId -eq "00000000-0000-0000-0000-000000000000"} 23 | $Devices | Where-Object {$_.azureADDeviceId -eq "00000000-0000-0000-0000-000000000000"} | select-obejct deviceName,serialnumber,userprincipalname 24 | ($Devices | Where-Object {$_.azureADDeviceId -eq "00000000-0000-0000-0000-000000000000"} | select-obejct deviceName,serialnumber,userprincipalname).count 25 | $Devices | Where-Object {$_.azureADDeviceId -eq "00000000-0000-0000-0000-000000000000"} | select-obejct deviceName,serialnumber,userprincipalname | Out-GridView 26 | $Devices | Where-Object {$_.azureADDeviceId -eq "00000000-0000-0000-0000-000000000000"} | select-obejct deviceName,serialnumber,userprincipalname | Out-GridHtml -------------------------------------------------------------------------------- /Intune/Update-Intune-Filter-Rule.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all members from a Cloud-based Security Group and add them as Devices into Intune Filter used to Exclude these targeted devcies from getting Existing App reinstalled. 4 | 5 | .DESCRIPTION 6 | This script checks created a working dir (c:\temp\YYYY\MM\DD\) and set its location to that workdir then if the list provided and the security group exists in the spcific tenant it runs. 7 | Check Lines 50, 56 and 57 for Input variables $tenant , $filterName and $phase2GroupName 8 | 9 | .NOTES 10 | Author: Thiago Beier 11 | Email: thiago.beier@gmail.com 12 | Blog: https://thebeier.com 13 | LinkedIn: https://www.linkedin.com/in/tbeier/ 14 | Twitter: https://twitter.com/thiagobeier 15 | Date: 03/06/2023 16 | Version: 1.0 17 | 18 | #> 19 | 20 | 21 | #Powershell Modules 22 | #Get-Module azuread 23 | #connect-azuread 24 | #Connect-MSGraph 25 | #Connect-MgGraph 26 | #Install-Module azureadpreview -AllowClobber -Force 27 | 28 | #region 00 - defaults 29 | $date = Get-Date -Format "yyyy-MM-dd" 30 | $fulldate = $date 31 | $fulldate.Split("-") 32 | $dtyear = $fulldate.Split("-")[0] 33 | $dtmonth = $fulldate.Split("-")[1] 34 | $dtday = $fulldate.Split("-")[2] 35 | $workdir = "c:\temp\$dtyear\$dtmonth\$dtday" 36 | 37 | if (Test-Path -Path $workdir) { 38 | "Working dir folder exists!" 39 | } 40 | else { 41 | "Working dir folder doesn't exist. Creating." 42 | New-Item -ItemType Directory -Path $workdir 43 | } 44 | set-location $workdir 45 | #endregion 46 | 47 | #region 01 - code 48 | #Date and time 49 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 50 | $LogFolder = "$workdir" 51 | $logfile = "$LogFolder\graphapi-update-filters-$dt.log" 52 | Start-Transcript -Path $logfile 53 | 54 | #Tenant Information 55 | $tenant = “YOURTENANTNAME.onmicrosoft.com” 56 | $Resource = "deviceManagement/assignmentFilters" 57 | $graphApiVersion = "Beta" 58 | $uri = "https://graph.microsoft.com/$graphApiVersion/$($resource)" 59 | 60 | #variables 61 | $filterName = "Exclude - McAfee" #This is the Filter Name 62 | $phase2GroupName = "Norton Install Phase 2" #This is the Cloud-based sec. group Name for Phase2 63 | 64 | #work on filters 65 | $Filters = Invoke-MSGraphRequest -HttpMethod GET -Url $uri 66 | $thisfilter = $Filters.value | Where-Object {$_.displayname -eq "$($filterName)"} 67 | 68 | #working on phase2 sec. group 69 | $aadgroup = Get-AzureADGroup -All:$true | Where-Object { ($_.DisplayName -like "$($phase2GroupName)*") } 70 | 71 | #clear arrays 72 | $aadgroupsarray = "" 73 | $currentrulelist1 = "" 74 | 75 | if ($thisfilter -and $aadgroup) { 76 | #export Backup - all existing filters 77 | Invoke-MSGraphRequest -HttpMethod GET -Url $uri | ConvertTo-Json | Out-File -FilePath .\Intune-Filters-$dt.json 78 | 79 | "Filter and Phase2 Group found. Proceeding" 80 | #working o filter 81 | $thisfilter.rule | Out-File thisfilter-$dt.txt 82 | $dd = ($thisfilter.rule -split ' or ') -ne '' 83 | $ee = $dd.Replace('(device.deviceName -eq "',"") 84 | $ff = $ee.Replace('")',"") 85 | $thisfilterdvclist = $ff | ForEach-Object {$_.trim()} | Sort-Object 86 | ($thisfilterdvclist | Sort-Object -Unique).count 87 | 88 | #device list from AAD device group 89 | $aadgroupsarray = @() 90 | # Loop through each item in the array and write it to the console 91 | foreach ($item in $phase2GroupName) { 92 | Write-Host $item 93 | $aadgroup = Get-AzureADGroup -All:$true | Where-Object { ($_.DisplayName -like "$($item)*") } 94 | $aadgroupmembers = Get-AzureADGroupMember -ObjectId $aadgroup.ObjectId 95 | $aadgroupsarray += $aadgroupmembers.displayname 96 | } 97 | ($aadgroupsarray | Sort-Object -Unique).count 98 | $filterrulelist = $aadgroupsarray | Sort-Object -Unique 99 | $filterrulelist.trim() 100 | 101 | #create array from graph api list 102 | #json rule format for devices from text file 103 | $currentrulelist1 = "" 104 | $currentrulelist1 = @() 105 | ForEach ($item in $filterrulelist.trim()) { 106 | 107 | $newdevicetoadd = '(device.deviceName -eq \"' + $item + '\")' 108 | $currentrulelist1 += $newdevicetoadd 109 | 110 | } 111 | #list on screen 112 | "" 113 | "NEW List from Phase2 Sec. Group has: $($currentrulelist1.count) Devices" 114 | 115 | #Create rule list to be parsed in JSON 116 | "JSON rule list" 117 | "" 118 | $JsonRuleList = "" 119 | $or = "or " 120 | $or.Length 121 | $newList = $currentrulelist1 122 | # Loop through each item in the array 123 | foreach ($item in $newList) { 124 | 125 | # Check if the current item is not the last item in the array 126 | if ($item -ne $newList[-1]) { 127 | # Concatenate the current item with the $or variable and append it to the output string 128 | $JsonRuleList += "$item $or" 129 | } 130 | else { 131 | # If the current item is the last item in the array, append it to the output string without the $or variable 132 | $JsonRuleList += "$item" 133 | } 134 | } 135 | 136 | # Output the final concatenated string 137 | $JsonRuleList 138 | 139 | #PATCH - Update filter 140 | "Filter: $($thisfilter.displayname) has ID: $($thisfilter.id)" 141 | $Resource = "deviceManagement/assignmentFilters" 142 | $graphApiVersion = "Beta" 143 | $uri2 = "https://graph.microsoft.com/beta/deviceManagement/assignmentFilters/$($thisfilter.id)" #PROD 144 | 145 | #JSON rule and rolescopetags. Only update RULE (add , remove objects + OR) 146 | $JSON = @" 147 | { 148 | "rule":"$($JsonRuleList)","roleScopeTags":["0"] 149 | } 150 | "@ 151 | 152 | $JSON #| Convertfrom-Json 153 | 154 | Invoke-MSGraphRequest -HttpMethod PATCH -Url $uri2 -Content $JSON #update filter rule 155 | 156 | } else {"Contact Automation Team"} 157 | 158 | 159 | Stop-Transcript 160 | 161 | #endregion -------------------------------------------------------------------------------- /Intune/find-uninstall-keys.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all installed apps uninstall keys 4 | 5 | .DESCRIPTION 6 | This script checks for all installed apps uninstall keys 7 | 8 | .NOTES 9 | Author: Thiago Beier 10 | Email: thiago.beier@gmail.com 11 | Blog: https://thebeier.com 12 | LinkedIn: https://www.linkedin.com/in/tbeier/ 13 | Twitter: https://twitter.com/thiagobeier 14 | Date: 03/19/2023 15 | Version: 1.0 16 | 17 | #> 18 | 19 | clear 20 | 21 | $productNames = @("*") 22 | $UninstallKeys = @('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 23 | 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall', 24 | 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' 25 | ) 26 | $results = foreach ($key in (Get-ChildItem $UninstallKeys) ) { 27 | 28 | foreach ($product in $productNames) { 29 | if ($key.GetValue("DisplayName") -like "$product") { 30 | [pscustomobject]@{ 31 | KeyName = $key.Name.split('\')[-1]; 32 | DisplayName = $key.GetValue("DisplayName"); 33 | UninstallString = $key.GetValue("UninstallString"); 34 | Publisher = $key.GetValue("Publisher"); 35 | } 36 | } 37 | } 38 | } 39 | 40 | $results | fl * 41 | 42 | -------------------------------------------------------------------------------- /Intune/intune-lastsyncdatetime-olderthan-date-to-aad-group.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all devices from Intune older and newer than $limit (30 days default) and add all devices to a cloud-based sec. group AAD / assigned group 4 | 5 | .DESCRIPTION 6 | This script retrieve all devices from Intune older and newer than $limit (30 days default) 7 | 8 | .NOTES 9 | Due to a limitation on MsGraph we grab the device Name and check its status in AAD isManaged isCompliant than retrieve its objectID (not in intune msgraph module) 10 | Add devices to a cloud-based sec. group used in app deployment exclusion 11 | $olderthanlimit => list AAD devices older than 30 days / $limit 12 | $newwerthanlimit => list AAD devices newer than 30 days / $limit 13 | $aaddevices => AAD devices that are Intune managed , compliant and newer than 30 days / $limit 14 | $uniqueArray => used to clear all duplicatd devices by name and objectid from aaddevices ( known issues for Hybrid Azure AD joined environment ) 15 | $targetGroupmembers => all AAD sec. group members 16 | Also check filter rules https://thiagobeier.wordpress.com/2023/03/09/automated-filter-population-in-intune/ 17 | 18 | .AUTHOR 19 | Author: Thiago Beier 20 | Email: thiago.beier@gmail.com 21 | Blog: https://thebeier.com 22 | LinkedIn: https://www.linkedin.com/in/tbeier/ 23 | Twitter: https://twitter.com/thiagobeier 24 | Date: 03/21/2023 25 | Version: 1.1 26 | #> 27 | 28 | Clear-Host 29 | 30 | #Date and time 31 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 32 | $logfile = "$env:temp\lastsynced-devices-$dt.log" 33 | Start-Transcript -Path $logfile 34 | 35 | #Variables 36 | $targetaadgroupname = "All-AAD-Devices-InActive-30-Days" 37 | 38 | #Connect to MSGraph and List all Windows Devices 39 | #Install-Module Microsoft.Graph -Scope AllUsers 40 | #Connect-MSGraph 41 | $Devices = Get-IntuneManagedDevice -Filter "contains(operatingsystem, 'Windows')" | Get-MSGraphAllPages 42 | 43 | #Define the amount of days to exclude from the search 44 | 45 | $limit = (Get-Date).AddDays(-30) #older than 30 days 46 | #Badr eddine Zaki asked for only devices active in the last 30 days 47 | #Uncomment this section if you need the group to add the devices that are older than 30 days to the group 48 | #added the opton to list older than 30 days 49 | $olderthanlimit = $Devices | Where-Object { $_.lastsyncdatetime -lt $limit } | Select-Object devicename, lastsyncdatetime, azureADDeviceId #older than 30 days 50 | #$olderthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -lt $limit} #all devices info 51 | #$olderthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -lt $limit} | export-csv -NoTypeInformation -Encoding all-devices-older-than-limit.csv #all devices info to csv 52 | "Older: $($olderthanlimit.count)" 53 | 54 | <# 55 | #Tthis section if you need the group to add the devices that are newer than 30 days to the group 56 | $newwerthanlimit = $Devices | Where-Object { $_.lastsyncdatetime -gt $limit } | Select-Object devicename, lastsyncdatetime, azureADDeviceId #only devicename and lastsyncdatetime 57 | #$newwerthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -gt $limit} #all devices info 58 | #$newwerthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -gt $limit} | export-csv -NoTypeInformation -Encoding all-devices-greater-than-limit.csv 59 | "Newer: $($newwerthanlimit.count)" 60 | #> 61 | 62 | #add devices by name, object it to AAD sec. group 63 | #connect-azuread 64 | $targetGroup = (AzureADPreview\Get-AzureADGroup -All:$true | Where-Object { ($_.DisplayName -like "$($targetaadgroupname)") }) #list target group info 65 | #$targetGroup #used to debug 66 | $targetGroupmembers = Get-AzureADGroupMember -All:$true -ObjectId $targetGroup.objectid 67 | $targetGroupmembers 68 | 69 | # Create empty array to store all Azure AD devices with devicename and objectid that are unique by name and objectid 70 | $aaddevices = "" 71 | $aaddevices = @() 72 | 73 | #$top10 = $olderthanlimit | Select-Object -First 10 #used to test with top 10 entries, uncoment line 74 and comment line 75 for this test with top10 74 | 75 | #foreach ($deviceitem in $top10) { #uncoment to test with top 10 devices from aad list // also uncomment line 74 76 | foreach ($deviceitem in $olderthanlimit) { 77 | #uncoment to switch to devices older than 30 days to sec. group // also uncomment block from lines 48 to 53 78 | #foreach ($deviceitem in $newwerthanlimit) { 79 | #default all devices 80 | "working on Device Name $($deviceitem.devicename) , AzureADOBjectID $($deviceitem.azureADDeviceId)" #from Intune $Deviceslist 81 | "" 82 | $validDevice = Get-AzureADDevice -SearchString $deviceitem.devicename | where-object { $_.IsCompliant -eq $true -and $_.ismanaged -eq $true -and $_.ApproximateLastLogonTimeStamp -gt $limit } #fixed ApproximateLastLogonTimeStamp // Activity property in Device Properties (GUI) 83 | #$validDevice used to debug 84 | "This device => $($validDevice.displayname)" 85 | $validDevice | foreach-object { 86 | "working on device: $($_.displayname) , ID: $($_.objectid)" 87 | $item = @{devicename = $_.displayname; objectid = $_.objectid } 88 | $aaddevices += $item 89 | } 90 | } 91 | #$thearray 92 | 93 | # Group objects by devicename and objectid and select the first item in each group 94 | $uniqueArray = $aaddevices | Group-Object -Property @{Expression = { $_.devicename + $_.objectid } } | ForEach-Object { $_.Group[0] } 95 | 96 | # Output unique array 97 | #$uniqueArray 98 | 99 | $uniqueArray.Count 100 | 101 | # Compare arrays and add devices to AAD sec. group if device name with objectid is not member of the AAD sec. group 102 | foreach ($obj1 in $uniqueArray) { 103 | $matchFound = $false 104 | foreach ($obj2 in $targetGroupmembers) { 105 | if ($obj1.objectid -eq $obj2.objectid) { 106 | $matchFound = $true 107 | Write-host -ForegroundColor Yellow "Object $($obj1.devicename) with objectid $($obj1.objectid) exist in AD Group" 108 | break 109 | } 110 | } 111 | if (-not $matchFound) { 112 | Write-Output "Object $($obj1.devicename) with objectid $($obj1.objectid) does not exist in AD Group" 113 | Add-AzureADGroupMember -ObjectId "$($targetgroup.ObjectId)" -RefObjectId "$($obj1.objectid)" 114 | } 115 | } 116 | 117 | Stop-Transcript 118 | -------------------------------------------------------------------------------- /Intune/intune-lastsyncdatetime-to-aad-group.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all devices from Intune older and newer than $limit (30 days default) and add all devices to a cloud-based sec. group AAD / assigned group 4 | 5 | .DESCRIPTION 6 | This script retrieve all devices from Intune older and newer than $limit (30 days default) 7 | 8 | .NOTES 9 | Due to a limitation on MsGraph we grab the device Name and check its status in AAD isManaged isCompliant than retrieve its objectID (not in intune msgraph module) 10 | Add devices to a cloud-based sec. group used in app deployment exclusion 11 | $olderthanlimit => list AAD devices older than 30 days / $limit 12 | $newwerthanlimit => list AAD devices newer than 30 days / $limit 13 | $aaddevices => AAD devices that are Intune managed , compliant and newer than 30 days / $limit 14 | $uniqueArray => used to clear all duplicatd devices by name and objectid from aaddevices ( known issues for Hybrid Azure AD joined environment ) 15 | $targetGroupmembers => all AAD sec. group members 16 | Also check filter rules https://thiagobeier.wordpress.com/2023/03/09/automated-filter-population-in-intune/ 17 | 18 | .AUTHOR 19 | Author: Thiago Beier 20 | Email: thiago.beier@gmail.com 21 | Blog: https://thebeier.com 22 | LinkedIn: https://www.linkedin.com/in/tbeier/ 23 | Twitter: https://twitter.com/thiagobeier 24 | Date: 03/21/2023 25 | Version: 1.0 26 | #> 27 | 28 | Clear-Host 29 | 30 | #Date and time 31 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 32 | $logfile = "$env:temp\lastsynced-devices-$dt.log" 33 | Start-Transcript -Path $logfile 34 | 35 | #Variables 36 | $targetaadgroupname = "All-AAD-Devices-Active-30-Days" 37 | 38 | #Connect to MSGraph and List all Windows Devices 39 | #Install-Module Microsoft.Graph -Scope AllUsers 40 | #Connect-MSGraph 41 | $Devices = Get-IntuneManagedDevice -Filter "contains(operatingsystem, 'Windows')" | Get-MSGraphAllPages 42 | 43 | #Define the amount of days to exclude from the search 44 | 45 | $limit = (Get-Date).AddDays(-30) #older than 30 days 46 | 47 | #Uncomment this section if you need the group to add the devices that are older than 30 days to the group 48 | <# 49 | #added the opton to list older than 30 days 50 | $olderthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -lt $limit} | select devicename,lastsyncdatetime,azureADDeviceId #older than 30 days 51 | #$olderthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -lt $limit} #all devices info 52 | #$olderthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -lt $limit} | export-csv -NoTypeInformation -Encoding all-devices-older-than-limit.csv #all devices info to csv 53 | "Older: $($olderthanlimit.count)" 54 | #> 55 | 56 | #Badr eddine Zaki asked for only devices active in the last 30 days 57 | #Tthis section if you need the group to add the devices that are newer than 30 days to the group 58 | $newwerthanlimit = $Devices | Where-Object { $_.lastsyncdatetime -gt $limit } | Select-Object devicename, lastsyncdatetime, azureADDeviceId #only devicename and lastsyncdatetime 59 | #$newwerthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -gt $limit} #all devices info 60 | #$newwerthanlimit = $Devices | Where-Object {$_.lastsyncdatetime -gt $limit} | export-csv -NoTypeInformation -Encoding all-devices-greater-than-limit.csv 61 | "Newer: $($newwerthanlimit.count)" 62 | 63 | #add devices by name, object it to AAD sec. group 64 | #connect-azuread 65 | $targetGroup = (AzureADPreview\Get-AzureADGroup -All:$true | Where-Object { ($_.DisplayName -like "$($targetaadgroupname)") }) #list target group info 66 | #$targetGroup #used to debug 67 | $targetGroupmembers = Get-AzureADGroupMember -All:$true -ObjectId $targetGroup.objectid 68 | $targetGroupmembers 69 | 70 | # Create empty array to store all Azure AD devices with devicename and objectid that are unique by name and objectid 71 | $aaddevices = "" 72 | $aaddevices = @() 73 | 74 | #$top10 = $newwerthanlimit | Select-Object -First 10 #used to test with top 10 entries, uncoment line 76 and comment line 78 for this test with top10 75 | 76 | #foreach ($deviceitem in $top10) { #uncoment to test with top 10 devices from aad list // also uncomment line 74 77 | #foreach ($deviceitem in $olderthanlimit) { #uncoment to switch to devices older than 30 days to sec. group // also uncomment block from lines 48 to 53 78 | foreach ($deviceitem in $newwerthanlimit) { 79 | #default all devices 80 | "working on Device Name $($deviceitem.devicename) , AzureADOBjectID $($deviceitem.azureADDeviceId)" #from Intune $Deviceslist 81 | "" 82 | $validDevice = Get-AzureADDevice -SearchString $deviceitem.devicename | where-object { $_.IsCompliant -eq $true -and $_.ismanaged -eq $true -and $_.ApproximateLastLogonTimeStamp -gt $limit } #fixed ApproximateLastLogonTimeStamp // Activity property in Device Properties (GUI) 83 | #$validDevice used to debug 84 | "This device => $($validDevice.displayname)" 85 | $validDevice | foreach-object { 86 | "working on device: $($_.displayname) , ID: $($_.objectid)" 87 | $item = @{devicename = $_.displayname; objectid = $_.objectid } 88 | $aaddevices += $item 89 | } 90 | } 91 | #$thearray 92 | 93 | # Group objects by devicename and objectid and select the first item in each group 94 | $uniqueArray = $aaddevices | Group-Object -Property @{Expression = { $_.devicename + $_.objectid } } | ForEach-Object { $_.Group[0] } 95 | 96 | # Output unique array 97 | #$uniqueArray 98 | 99 | $uniqueArray.Count 100 | 101 | # Compare arrays and add devices to AAD sec. group if device name with objectid is not member of the AAD sec. group 102 | foreach ($obj1 in $uniqueArray) { 103 | $matchFound = $false 104 | foreach ($obj2 in $targetGroupmembers) { 105 | if ($obj1.objectid -eq $obj2.objectid) { 106 | $matchFound = $true 107 | Write-host -ForegroundColor Yellow "Object $($obj1.devicename) with objectid $($obj1.objectid) exist in AD Group" 108 | break 109 | } 110 | } 111 | if (-not $matchFound) { 112 | Write-Output "Object $($obj1.devicename) with objectid $($obj1.objectid) does not exist in AD Group" 113 | Add-AzureADGroupMember -ObjectId "$($targetgroup.ObjectId)" -RefObjectId "$($obj1.objectid)" 114 | } 115 | } 116 | 117 | Stop-Transcript 118 | -------------------------------------------------------------------------------- /Intune/intune-list-serialnumber.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script list current device serial number (to be imported to windows autopilot in Intune) 4 | .DESCRIPTION 5 | This script list current device serial number (to be imported to windows autopilot in Intune) 6 | .NOTES 7 | Author: Thiago Beier 8 | Email: thiago.beier@gmail.com 9 | Blog: https://thebeier.com 10 | LinkedIn: https://www.linkedin.com/in/tbeier/ 11 | Twitter: https://twitter.com/thiagobeier 12 | Date: 03/28/2023 13 | Version: 1.0 14 | #> 15 | 16 | clear 17 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force 18 | $session = New-CimSession 19 | $serial = (Get-CimInstance -CimSession $session -Class Win32_BIOS).SerialNumber 20 | $serial 21 | $serial | clip -------------------------------------------------------------------------------- /Intune/intune-msgraph-retrieve-device-info-by-serial.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script list current device info by serial number given (Windows or macOS) 4 | 5 | .DESCRIPTION 6 | This script list current device info by serial number given (Windows or macOS) 7 | Edit line 23 if you want to add the SERIAL here, comment out line 21 if this option is selected 8 | 9 | .NOTES 10 | Author: Thiago Beier 11 | Email: thiago.beier@gmail.com 12 | Blog: https://thebeier.com 13 | LinkedIn: https://www.linkedin.com/in/tbeier/ 14 | Twitter: https://twitter.com/thiagobeier 15 | Date: 05/09/2023 16 | Version: 1.0 17 | #> 18 | 19 | Connect-MSGraph 20 | 21 | $Serial = read-host “Please Enter the Serial Number” 22 | 23 | #$Serial = "ADD-THE-SERIAL-HERE" 24 | 25 | $MyDevice = Get-IntuneManagedDevice | Get-MSGraphAllPages | Where-Object {$_.SerialNumber -match $Serial} 26 | 27 | $MyDevice -------------------------------------------------------------------------------- /Intune/intune-windows-autopilot-temporary-group.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script list current devices enrolled into intune or registered in autopilot and add to cloud-based security group 4 | 5 | .DESCRIPTION 6 | This script list current autopilot enrollment status 7 | Checks IDs across Intune, Windows Autopilot devices and Azure AD and validate which device by name and objectID is the device to be added to sec. group 8 | Please check Diagarm to understand IDs correlation and usage in ADDS, AzureAD (AAD) and Intune. 9 | 10 | .NOTES 11 | Author: Thiago Beier 12 | Email: thiago.beier@gmail.com 13 | Blog: https://thebeier.com 14 | LinkedIn: https://www.linkedin.com/in/tbeier/ 15 | Twitter: https://twitter.com/thiagobeier 16 | Date: 05/11/2023 17 | Version: 1.0 18 | #> 19 | 20 | clear-host 21 | 22 | 23 | $targetAzureADGroupName = "Windows Autopilot Temporary" 24 | 25 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 26 | $logfile = "$env:temp\windows-autopilot-temporary-$dt.log" 27 | 28 | Start-Transcript -Path $logfile 29 | 30 | Write-Host "Connecting with MSGraph and AzureAD" 31 | Connect-MSGraph # Please update as per your environment 32 | Connect-AzureAD # Please update as per your environment 33 | 34 | #start date to list devices enrolled or registered to autopilot 35 | $startdate = "2023-05-10" 36 | 37 | #add devices by name, object it to AAD sec. group 38 | Write-Host "Fetching Target Group" 39 | $targetGroup = (Get-AzureADGroup -All:$true | Where-Object { ($_.DisplayName -like "$($targetAzureADGroupName)") }) 40 | 41 | Write-Host "Windows Autopilot Device" 42 | $windowsAutopilot = Get-AutopilotEvent | Where-Object { $_.deploymentEndDateTime -gt $startdate } 43 | 44 | Write-Host "Intune Managed Device" 45 | $windowsAutopilot | ForEach-Object { 46 | 47 | $b = $_.deviceSerialNumber 48 | 49 | $MyDevice = Get-IntuneManagedDevice | Get-MSGraphAllPages | Where-Object { $_.SerialNumber -match $b } 50 | $intune = $MyDevice | Select-Object devicename, id, userid, managedDeviceId, enrolleddateimte, lastsyncdatetime, serialnumber, userprincipalname 51 | #$intune 52 | 53 | $intune | ForEach-Object { 54 | Write-Host "AAD device" 55 | $_.deviceName 56 | $_.serialnumber 57 | 58 | $aad = get-azureaddevice -all:$true -SearchString "$($_.deviceName)" #| fl displayname,deviceid,objectid,*time*,profiletype,accountenabled 59 | $aad.DisplayName 60 | $aad.DeviceId 61 | $aad.ObjectId 62 | 63 | ## 64 | # Get the members of the Azure AD group 65 | $groupMembers = Get-AzureADGroupMember -ObjectId $targetgroup.ObjectId 66 | 67 | # Check if the device exists in the group 68 | $deviceExists = $false 69 | 70 | foreach ($member in $groupMembers) { 71 | if ($member.ObjectId -eq $aad.ObjectId) { 72 | $deviceExists = $true 73 | break 74 | } 75 | } 76 | 77 | # Output the result 78 | if ($deviceExists) { 79 | Write-Host "The device $($aad.deviceName) exists in the Azure AD group." 80 | } 81 | else { 82 | Write-Host "The device $($aad.deviceName) does not exist in the Azure AD group." 83 | Write-Host "Adding $($aad.deviceName) , SerialNumber $($_.serialnumber) to Group $($targetgroup.DisplayName)" 84 | Add-AzureADGroupMember -ObjectId $targetgroup.ObjectId -RefObjectId $aad.ObjectId 85 | 86 | } 87 | ## 88 | 89 | } 90 | 91 | 92 | } 93 | 94 | $windowsAutopilot.managedDeviceName 95 | $windowsAutopilot.deviceSerialNumber 96 | 97 | Stop-Transcript 98 | -------------------------------------------------------------------------------- /Intune/list-local-admin-members-per-device-v2.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all members from local admin group from a specific device for those with issues on PowerShell from previous script published. 4 | .DESCRIPTION 5 | This script retrieve all members from local admin group from a specific device 6 | V1 PowerShell https://github.com/thiagobeier/Script/blob/master/Intune/list-local-admin-members-per-device.ps1 7 | .NOTES 8 | Author: Thiago Beier 9 | Email: thiago.beier@gmail.com 10 | Blog: https://thebeier.com 11 | LinkedIn: https://www.linkedin.com/in/tbeier/ 12 | Twitter: https://twitter.com/thiagobeier 13 | Date: 04/11/2023 14 | Version: 1.0 15 | #> 16 | 17 | 18 | function Show-AdministratorGroupMembers { 19 | $administrators = @( 20 | ([ADSI]"WinNT://./Administrators").psbase.Invoke('Members') | 21 | ForEach-Object { 22 | $_.GetType().InvokeMember('AdsPath', 'GetProperty', $null, $($_), $null) 23 | } 24 | ) -match '^WinNT'; 25 | 26 | $administrators = $administrators -replace 'WinNT://', '' 27 | $administrators 28 | 29 | } 30 | Show-AdministratorGroupMembers 31 | -------------------------------------------------------------------------------- /Intune/list-local-admin-members-per-device-v3.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all members from local admin group from a specific device 4 | .DESCRIPTION 5 | This script retrieve all members from local admin group from a specific device 6 | Saves to CSV file using $dt variable on the name as well DEVICE NAME from $env:computername 7 | .NOTES 8 | Author: Thiago Beier 9 | Email: thiago.beier@gmail.com 10 | Blog: https://thebeier.com 11 | LinkedIn: https://www.linkedin.com/in/tbeier/ 12 | Twitter: https://twitter.com/thiagobeier 13 | Date: 04/11/2023 14 | Version: 3.0 15 | #> 16 | 17 | 18 | # Date and Time 19 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 20 | 21 | $thisPC = $env:COMPUTERNAME 22 | $list = new-object -TypeName System.Collections.ArrayList 23 | foreach ($computer in $thisPC) { 24 | $admins = Get-WmiObject -Class win32_groupuser -ComputerName $computer | 25 | Where-Object {$_.groupcomponent -like '*"Administrators"'} 26 | $obj = New-Object -TypeName PSObject -Property @{ 27 | ComputerName = $computer 28 | LocalAdmins = $null 29 | } 30 | foreach ($admin in $admins) { 31 | $null = $admin.partcomponent -match '.+Domain\=(.+)\,Name\=(.+)$' 32 | $null = $matches[1].trim('"') + '\' + $matches[2].trim('"') + "`n" 33 | $obj.Localadmins += $matches[1].trim('"') + '\' + $matches[2].trim('"') + "`n" 34 | } 35 | $null = $list.add($obj) 36 | } 37 | $list 38 | # Create an empty array 39 | $admins = @() 40 | 41 | # Loop through the $result object and add each row as a new item in the $admins array 42 | foreach ($row in $result) { 43 | $admin = [PSCustomObject]@{ 44 | "DeviceName" = $env:COMPUTERNAME 45 | "Name" = $row.Name 46 | "Source" = $row.PrincipalSource 47 | } 48 | $admins += $admin 49 | } 50 | 51 | # Output the $admins array to the console 52 | $admins | Export-Csv $env:COMPUTERNAME-admins-$dt.csv -NoTypeInformation -------------------------------------------------------------------------------- /Intune/list-local-admin-members-per-device.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script retrieve all members from local admin group from a specific device 4 | .DESCRIPTION 5 | This script retrieve all members from local admin group from a specific device 6 | Saves to CSV file using $dt variable on the name as well DEVICE NAME from $env:computername 7 | .NOTES 8 | Author: Thiago Beier 9 | Email: thiago.beier@gmail.com 10 | Blog: https://thebeier.com 11 | LinkedIn: https://www.linkedin.com/in/tbeier/ 12 | Twitter: https://twitter.com/thiagobeier 13 | Date: 04/11/2023 14 | Version: 1.0 15 | #> 16 | 17 | 18 | # Date and Time 19 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 20 | 21 | # Result as the Get-LocalGroupMember 22 | 23 | $result = Get-LocalGroupMember -Group administrators | Select-Object Name, PrincipalSource 24 | 25 | $result | Export-Csv $env:COMPUTERNAME-$dt.csv -NoTypeInformation #To CSV using $dt variable on the name as well DEVICE NAME from $env:computername 26 | 27 | # Create an empty array 28 | $admins = @() 29 | 30 | # Loop through the $result object and add each row as a new item in the $admins array 31 | foreach ($row in $result) { 32 | $admin = [PSCustomObject]@{ 33 | "DeviceName" = $env:COMPUTERNAME 34 | "Name" = $row.Name 35 | "PrincipalSource" = $row.PrincipalSource 36 | } 37 | $admins += $admin 38 | } 39 | 40 | # Output the $admins array to the console 41 | $admins 42 | 43 | # Output the $admins array to CSV file name 44 | $admins | Export-Csv $env:COMPUTERNAME-admins-$dt.csv -NoTypeInformation #To CSV using $dt variable on the name as well DEVICE NAME from $env:computername 45 | -------------------------------------------------------------------------------- /Intune/macOS/macos-retrieve-serialNumber.sh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | # Retrieve macOS Serial Number 3 | ioreg -l | grep IOPlatformSerialNumber 4 | 5 | -------------------------------------------------------------------------------- /Intune/ppkg/CMTrace.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Intune/ppkg/CMTrace.exe -------------------------------------------------------------------------------- /Intune/ppkg/create-vm-hyperv.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script creates a vm with specified Name at c:\VMS\ attaching existing ISO from c:\VMS\isos\ 4 | This powershell will create c:\VMS\ and c:\VMS\isos\ if don't exist 5 | 6 | .DESCRIPTION 7 | This is customized for my Hyper-v running on Microsoft Windows 11 Enterprise 8 | Have your ISO file downloaded on the folder before you run this powershell 9 | Update $vmFolderPath $isosFolderPath $myvmname and $isofile prior you run this script 10 | 11 | .HARDWARE 12 | System Manufacturer Dell Inc. 13 | System Model Latitude 5520 14 | Installed Physical Memory (RAM) 32.0 GB 15 | 16 | .REFERENCES 17 | https://docs.microsoft.com/en-us/powershell/module/hyper-v/set-vmfirmware?view=windowsserver2019-ps 18 | https://www.itexperience.net/fix-this-device-cant-use-a-trusted-platform-module/ 19 | 20 | 21 | .NOTES 22 | Author: Thiago Beier 23 | Email: thiago.beier@gmail.com 24 | Blog: https://thebeier.com 25 | LinkedIn: https://www.linkedin.com/in/tbeier/ 26 | Twitter: https://twitter.com/thiagobeier 27 | Date: 03/29/2023 28 | Version: 1.0 29 | #> 30 | 31 | # Variables 32 | #create folder if don't exist 33 | $vmFolderPath = "c:\vms" 34 | $isosFolderPath = "c:\vms\isos" 35 | 36 | #define vm name 37 | $myvmname = "NULL" 38 | #$isofile = "c:\vms\isos\en-us_windows_11_business_editions_version_22h2_updated_oct_2022_x64_dvd_080047de.iso" #windows 11 ISO 39 | $isofile = "c:\vms\isos\en-us_windows_server_2022_updated_dec_2022_x64_dvd_14fe3ddc.iso" #SERVER 2022 40 | 41 | #create $vmFolderPath and $isosFolderPath if don't exist 42 | 43 | if (!(Test-Path $vmFolderPath)) { 44 | New-Item -ItemType Directory -Path $vmFolderPath | Out-Null 45 | } 46 | 47 | if (!(Test-Path $isosFolderPath)) { 48 | New-Item -ItemType Directory -Path $isosFolderPath | Out-Null 49 | } 50 | 51 | # Functions 52 | #This is a yesNo prompt funcion used on CreateVM function 53 | 54 | function Get-YesNoPrompt { 55 | [CmdletBinding()] 56 | param ( 57 | [string] $Message = "Are you sure you want to proceed?" 58 | ) 59 | 60 | $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Proceed with the operation." 61 | $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Cancel the operation." 62 | $choices = [System.Management.Automation.Host.ChoiceDescription[]] ($yes, $no) 63 | $defaultChoice = [System.Management.Automation.Host.ChoiceDescription] $no 64 | 65 | $decision = $Host.UI.PromptForChoice($null, $Message, $choices, 1) 66 | 67 | if ($decision -eq 0) { 68 | return $true 69 | } 70 | else { 71 | return $false 72 | } 73 | } 74 | 75 | 76 | 77 | #This function creates the VM from variable using ISO from variables under $vmFolderPath = "c:\vms" and $isosFolderPath = "c:\vms\isos" 78 | #Asks to confirm before proceeding 79 | 80 | function CreateVM { 81 | 82 | #prompt yesNo function 83 | if (Get-YesNoPrompt "Are you sure you want to proceed with VM creation => VMName: $($myvmname) and $($isofile) ?") { 84 | # User chose "Yes", so proceed with the operation. 85 | 86 | 87 | if ((Test-Path $isofile) -and !(get-vm -Name $myvmname -ErrorAction SilentlyContinue)) { #checks for $myvmname and $isofile ISO not found = error, VM same name exists ERROR 88 | write-host -ForegroundColor Green "Creating VM: $($myvmname) from ISO: $($isofile)" 89 | #create vm on hyperv 90 | New-VM -Name $myvmname -MemoryStartupBytes 8GB -BootDevice VHD -NewVHDPath C:\VMS\$myvmname\$myvmname.vhdx -Path C:\VMS\$myvmname\ -NewVHDSizeBytes 60GB -Generation 2 -Switch "Default Switch" 91 | Add-VMDvdDrive -Path $isofile -VMName $myvmname 92 | Set-VMProcessor -VMName "$myvmname" -count 2 93 | 94 | #update, change boot order 95 | $myvm = Get-VMFirmware -VMName $myvmname 96 | $myvm.bootorder #default vm has pxe, hdd, dvddrive order 97 | $hddrive = $myvm.BootOrder[0] 98 | $pxe = $myvm.BootOrder[1] 99 | $dvddrive = $myvm.BootOrder[2] 100 | 101 | Set-VMFirmware -VMName $myvmname -BootOrder $dvddrive,$hddrive,$pxe #update/change bootorder to dvd, hdd, pxe 102 | $myvm = Get-VMFirmware -VMName $myvmname 103 | $myvm.bootorder 104 | 105 | #Enable TPM module on vm 106 | 107 | #Type the following cmdlet to import the Hyper-V module: 108 | import-module Hyper-V 109 | #Copy-paste the following cmdlets to configure a valid key protector 110 | $owner = Get-HgsGuardian UntrustedGuardian 111 | $kp = New-HgsKeyProtector -Owner $owner -AllowUntrustedRoot 112 | #You have now created a valid key protector. You may now apply the HgsKeyProtector to the VM: 113 | Set-VMKeyProtector -VMName $myvmname -KeyProtector $kp.RawData 114 | #(obviously, replace with the name of your Virtual Machine, as shown in HyperV Manager. 115 | #You can now turn TPM with this cmdlet: 116 | Enable-VMTPM -VMName $myvmname 117 | 118 | #start vm and connect 119 | Checkpoint-VM -Name $myvmname -SnapshotName "FreshVM" #before setup / hash uploaded 120 | 121 | #sleep for 10 seconds 122 | Start-Sleep -Seconds 10 123 | 124 | #start vm and connect to it 125 | Start-VM -VMName $myvmname 126 | vmconnect.exe localhost $myvmname 127 | 128 | } else {write-host -ForegroundColor Red "ISO file not found or VM exists"} 129 | 130 | } 131 | else { 132 | # User chose "No", so cancel the operation. 133 | } 134 | 135 | } 136 | 137 | 138 | <# 139 | Additional commands 140 | 141 | #save a checkpoint 142 | #Checkpoint-VM -Name $myvmname -SnapshotName "OSready" #before setup / hash imported to autopilot if that's the case 143 | #Checkpoint-VM -Name $myvmname -SnapshotName "Finished Windows install" #after hash uploaded 144 | 145 | #dvd 146 | #Get-VM $myvmname | Get-VMDvdDrive 147 | #Set-VMDvdDrive -VMName $myvmname -ControllerNumber 0 -ControllerLocation 1 -Path $null 148 | #Get-VMDvdDrive -VMName $myvmname | Set-VMDvdDrive -Path "C:\vms\ISOS\Tools.iso" 149 | #Get-VMDvdDrive -VMName $myvmname | Set-VMDvdDrive -Path "C:\vms\ISOS\USB.iso" 150 | 151 | #Get-Command -Module hyper-v | Out-GridView 152 | #get-vm -Name $myvmname 153 | 154 | #> 155 | 156 | 157 | 158 | CreateVM 159 | -------------------------------------------------------------------------------- /Intune/ppkg/locationidv2.txt: -------------------------------------------------------------------------------- 1 | Default 2 | Australia 3 | Brazil 4 | Canada 5 | USA -------------------------------------------------------------------------------- /Intune/ppkg/register-autopilot.ps1: -------------------------------------------------------------------------------- 1 | <############################################################################################################# 2 | Description: Check if Windows Autopilot Device exists and import / update it based on Default or LOCATION code 3 | Author: Thiago Beier thiago.beier@gmail.com @thiagobeier 4 | Usage: registers Windows devices to autopilot - Intune - Default 5 | Envirionment: DEV - CONTOSO 6 | Version: 1.1 - parameter Capitalized Case sensitive based on latest .\get-windowsautopilotinfo.ps1 or get-windowsautopilotinfocommunity.ps1 v3.0.4 - Wipe fix 7 | #############################################################################################################> 8 | 9 | 10 | clear-host 11 | 12 | #region Functions 13 | 14 | # Functions 15 | # Function to send notificaton to teams 16 | function SendTeamsNotification { 17 | #sending end-user toast notification 18 | Write-Output 'sending end-user toast notification' 19 | 20 | $payload = @{ 21 | "channel" = "#general" 22 | "text" = "

Alert


Current Device NameCurrent LOCATION-ID codeDate & TimeSERIALNew LOCATION-ID code
$env:COMPUTERNAME$($tmp.grouptag)$dt$serial$DefaultGroupTag
" 23 | } 24 | 25 | #then we invoke web request using the uri which is the Teamswebhook url alongside the post method to send our request 26 | Invoke-WebRequest -UseBasicParsing ` 27 | -Body (ConvertTo-Json -Compress -InputObject $payload) ` 28 | -Method Post ` 29 | -Uri "" 30 | Write-Output "The condition was true" 31 | } 32 | 33 | #endregion 34 | 35 | #region requirements 36 | $LogFolder = 'C:\Logs' 37 | #endregion 38 | 39 | #region logfolder 40 | #Test to see if folder [$LogFolder] exists" 41 | if (Test-Path -Path $LogFolder) { 42 | "Log folder exists!" 43 | } else { 44 | "Log folder doesn't exist." 45 | New-Item -ItemType Directory -Path $LogFolder 46 | } 47 | #endregion 48 | 49 | #Date and time 50 | $dt = Get-Date -Format "dd-MM-yyyy-HH-mm-ss" 51 | $logfile = "$LogFolder\autopilot-registration-$dt.log" 52 | Start-Transcript -Path $logfile 53 | 54 | # begin 55 | 56 | 57 | # Gather Autopilot details 58 | "Gathering Autopilot details" 59 | $session = New-CimSession 60 | $serial = (Get-CimInstance -CimSession $session -Class Win32_BIOS).SerialNumber 61 | $devDetail = (Get-CimInstance -CimSession $session -Namespace root/cimv2/mdm/dmmap -Class MDM_DevDetail_Ext01 -Filter "InstanceID='Ext' AND ParentID='./DevDetail'") 62 | $hash = $devDetail.DeviceHardwareData 63 | 64 | "Installing Required PowerShell modules" 65 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 66 | 67 | # Add the .\get-windowsautopilotinfo.ps1 community version requirements to not fail running it straight from PowerShell Gallery 68 | $getwindowsautopilotinfocommunity = Get-InstalledScript get-windowsautopilotinfocommunity 69 | if ($getwindowsautopilotinfocommunity) { 70 | "getwindowsautopilotinfocommunity found" 71 | Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.208 -Confirm:$false -Force:$true 72 | } else { 73 | #Install-Script -Name get-windowsautopilotinfocommunity -Confirm:$false -Force:$true 74 | Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.208 -Confirm:$false -Force:$true 75 | } 76 | 77 | # Registering Device in Windows autopilot devices 78 | "Registering Device in Windows autopilot devices" 79 | #$DefaultGroupTag = "AADJ" #this is for Azure AD domain join windows autopilot deployment profile 80 | $DefaultGroupTag = "" #this is for Hybrid Azure AD domain join windows autopilot deployment profile (default) 81 | 82 | # Sending Teams Notification to Teams Channel 83 | "Sending Teams Notification to Teams Channel" 84 | #SendTeamsNotification 85 | 86 | "Wait until device restarts to proceed with Autopilot" 87 | .\get-windowsautopilotinfo.ps1 -Online -TenantId -AppId -AppSecret -GroupTag $DefaultGroupTag -Assign -Reboot -Verbose 88 | 89 | 90 | # end 91 | Stop-Transcript 92 | -------------------------------------------------------------------------------- /Intune/proactive remediation/contoso-device-name-standard/contoso-device-name-standard-detection.ps1: -------------------------------------------------------------------------------- 1 |  2 | # Detect Device Name and create BUXX BULC 3 | function Get-DsRegCmd { 4 | $DsRegCmd = $env:COMPUTERNAME 5 | return $Dsregcmd 6 | } 7 | 8 | $DSREG_Output = Get-DsRegCmd 9 | #$DSREG_Output 10 | 11 | 12 | function Get-DeviceNameStatus { 13 | #$DSREG_Output 14 | #clear 15 | $name = $DSREG_Output 16 | 17 | if ($name -like "DESKTOP*" -or $name -like "Auto*") { #{"y"} else {"n"} 18 | #"default" 19 | #buxx 20 | return "Not compliant" 21 | Write-Warning "Not Compliant" 22 | Exit 1 23 | } else { 24 | return "Compliant" 25 | Write-Output "Compliant" 26 | Exit 0 27 | } 28 | } 29 | 30 | Get-DeviceNameStatus -------------------------------------------------------------------------------- /Intune/proactive remediation/contoso-device-name-standard/contoso-device-name-standard-remediation.ps1: -------------------------------------------------------------------------------- 1 |  2 | #region Display Toast 3 | function Display-ToastNotification() { 4 | $Load = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] 5 | $Load = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] 6 | # Load the notification into the required format 7 | $ToastXML = New-Object -TypeName Windows.Data.Xml.Dom.XmlDocument 8 | $ToastXML.LoadXml($Toast.OuterXml) 9 | 10 | # Display the toast notification 11 | try { 12 | [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($App).Show($ToastXml) 13 | } 14 | catch { 15 | Write-Output -Message 'Something went wrong when displaying the toast notification' -Level Warn 16 | Write-Output -Message 'Make sure the script is running as the logged on user' -Level Warn 17 | } 18 | } 19 | # Setting image variables 20 | $LogoImageUri = "https://csi0101.blob.core.windows.net/img/hommer3.gif" 21 | $HeroImageUri = "https://csi0101.blob.core.windows.net/img/hommer1.gif" 22 | $LogoImage = "$env:TEMP\ToastLogoImage.png" 23 | $HeroImage = "$env:TEMP\ToastHeroImage.png" 24 | $Uptime= get-computerinfo | Select-Object OSUptime 25 | 26 | #Fetching images from uri 27 | Invoke-WebRequest -Uri $LogoImageUri -OutFile $LogoImage 28 | Invoke-WebRequest -Uri $HeroImageUri -OutFile $HeroImage 29 | 30 | #Defining the Toast notification settings 31 | #ToastNotification Settings 32 | $Scenario = 'reminder' # 33 | 34 | # Load Toast Notification text 35 | $AttributionText = "### ALERT ! ###" 36 | $HeaderText = "Please rename your device!" 37 | $TitleText = "Your device is not in compliance with Naming Standards" 38 | $BodyText1 = "Make sure Device name is renamed." 39 | $BodyText2 = "Please contact Local IT. Thank you in advance." 40 | 41 | 42 | # Check for required entries in registry for when using Powershell as application for the toast 43 | # Register the AppID in the registry for use with the Action Center, if required 44 | $RegPath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings' 45 | $App = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe' 46 | 47 | # Creating registry entries if they don't exists 48 | if (-NOT(Test-Path -Path "$RegPath\$App")) { 49 | New-Item -Path "$RegPath\$App" -Force 50 | New-ItemProperty -Path "$RegPath\$App" -Name 'ShowInActionCenter' -Value 1 -PropertyType 'DWORD' 51 | } 52 | 53 | # Make sure the app used with the action center is enabled 54 | if ((Get-ItemProperty -Path "$RegPath\$App" -Name 'ShowInActionCenter' -ErrorAction SilentlyContinue).ShowInActionCenter -ne '1') { 55 | New-ItemProperty -Path "$RegPath\$App" -Name 'ShowInActionCenter' -Value 1 -PropertyType 'DWORD' -Force 56 | } 57 | 58 | 59 | # Formatting the toast notification XML 60 | [xml]$Toast = @" 61 | 62 | 63 | 64 | 65 | 66 | $AttributionText 67 | $HeaderText 68 | 69 | 70 | $TitleText 71 | 72 | 73 | 74 | 75 | $BodyText1 76 | 77 | 78 | 79 | 80 | $BodyText2 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | "@ 90 | 91 | #Send the notification 92 | Display-ToastNotification 93 | #Exit 0 94 | #endregion -------------------------------------------------------------------------------- /Intune/proactive remediation/contoso-recover-local-admin/detect-create-localadmin.ps1: -------------------------------------------------------------------------------- 1 | #============================================================================================================================= 2 | # 3 | # Script Name: Detect_Local_Admin_Account 4 | # Description: Detect Local Admin Account (Standard Account) 5 | # Notes: Detect New Local Admin Account (Standard Account) 6 | # If User Exists, Update its password to standard 7 | # If User doesn't Exist, creates it with standard password 8 | # Update all other local accounts to standard password 9 | # Author: Thiago Beier 10 | # @thiagobeier https://thebeier.com https://github.com/thiagobeier 11 | # Toronto, CANADA 12 | # Version: 1.0 13 | #============================================================================================================================= 14 | 15 | # Define Functions 16 | function UpdateLocalAccountsPassword { 17 | $localadminuser = "NewLocalAdmin" #update the local admin upn 18 | get-localuser | Where-Object {$_.Name -ne $($localadminuser) -and $_.enabled -ne $false} | ForEach-Object { 19 | $_ 20 | #$_ | Set-LocalUser -Password $Password 21 | } 22 | } 23 | 24 | # Define Variables 25 | try 26 | { 27 | $localadminuser = "NewLocalAdmin" #update the local admin upn 28 | $findlocaluser = get-localuser | Where-Object {$_.Name -eq "$($localadminuser)"} 29 | if ($findlocaluser) { 30 | #write-host -Foregroundcolor green "User $($localadminuser) Found" 31 | "Compliant" 32 | #UpdateLocalAccountsPassword #set all enabled users new password to Standard Password 33 | exit 0 34 | } else { 35 | #write-host -Foregroundcolor red "User $($localadminuser) not found" 36 | "Not Compliant" 37 | #CreateLocalUser #create new local admin 38 | #UpdateLocalAccountsPassword #set all enabled users new password to Standard Password 39 | exit 1 40 | } 41 | } 42 | catch{ 43 | $errMsg = $_.Exception.Message 44 | Write-Error $errMsg 45 | exit 1 46 | } 47 | -------------------------------------------------------------------------------- /Intune/proactive remediation/contoso-recover-local-admin/remediate-create-localadmin.ps1: -------------------------------------------------------------------------------- 1 | #============================================================================================================================= 2 | # 3 | # Script Name: Remediate_Local_Admin_Account 4 | # Description: Detect Local Admin Account (Standard Account) 5 | # Notes: Detect New Local Admin Account (Standard Account) 6 | # If User Exists, Update its password to standard 7 | # If User doesn't Exist, creates it with standard password 8 | # Update all other local accounts to standard password 9 | # Author: Thiago Beier 10 | # @thiagobeier https://thebeier.com https://github.com/thiagobeier 11 | # Toronto, CANADA 12 | # Version: 1.0 13 | #============================================================================================================================= 14 | 15 | # Define Variables 16 | # remediate 17 | clear 18 | "" 19 | # Create New Local Admin Account 20 | #Variables 21 | $pass = "P@ssword1" #update the password 22 | $password = $pass | ConvertTo-SecureString -AsPlainText -Force 23 | $localadminuser = "NewLocalAdmin" #update the local admin upn 24 | $localadminfullname = "New Local Admin" #update the local admin full name 25 | $localadmindescription = "New Local Admin" #update the local admin description 26 | 27 | #Functions 28 | function CreateLocalUser { 29 | New-LocalUser -Name $localadminuser -Password $password -FullName $localadminfullname -Description $localadmindescription 30 | Add-LocalGroupMember -Group Users -Member NewLocalAdmin 31 | Add-LocalGroupMember -Group Administrators -Member NewLocalAdmin 32 | } 33 | 34 | function UpdateLocalAccountsPassword { 35 | get-localuser | Where-Object {$_.Name -ne "$($localadminuser)" -and $_.enabled -ne $false} | ForEach-Object { 36 | $_ 37 | #$_ | Set-LocalUser -Password $Password 38 | } 39 | } 40 | 41 | # Locate local user 42 | 43 | try 44 | { 45 | $findlocaluser = get-localuser | Where-Object {$_.Name -eq "$($localadminuser)"} 46 | if ($findlocaluser) { 47 | write-host -Foregroundcolor green "User $($localadminuser) Found" 48 | "Updating all other users password" 49 | UpdateLocalAccountsPassword #set all enabled users new password to Standard Password 50 | #exit 0 51 | } else { 52 | write-host -Foregroundcolor red "User $($localadminuser) not found" 53 | CreateLocalUser #create new local admin 54 | UpdateLocalAccountsPassword #set all enabled users new password to Standard Password 55 | #exit 1 56 | } 57 | } 58 | catch{ 59 | $errMsg = $_.Exception.Message 60 | Write-Error $errMsg 61 | #exit 1 62 | } 63 | 64 | 65 | 66 | 67 | "" 68 | -------------------------------------------------------------------------------- /Intune/proactive remediation/detect and copy outlook template files/detection-sync-outlook-template-multiple-files.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script syncs Outlook Template Files to users / detection (multiple files) 4 | .DESCRIPTION 5 | This script requires Intune Proactive Remediation Task 6 | .NOTES 7 | Author: Thiago Beier 8 | Email: thiago.beier@gmail.com 9 | Blog: https://thebeier.com 10 | LinkedIn: https://www.linkedin.com/in/tbeier/ 11 | Twitter: https://twitter.com/thiagobeier 12 | Date: 04/19/2023 13 | Version: 1.0 14 | #> 15 | 16 | $url1 = "https://YOUR-STORAGE-URL/PROJECT - TOPIC1.oft" 17 | $url2 = "https://YOUR-STORAGE-URL/PROJECT - TOPIC2.oft" 18 | $url3 = "https://YOUR-STORAGE-URL/PROJECT - TOPIC .oft" 19 | #$url4 = "https://www.example.com/file3.txt" 20 | 21 | # Add the URLs to an array 22 | $urlArray = @($url1, $url2, $url3) 23 | 24 | 25 | # Loop the URL array to grab the file name with extention 26 | foreach ($url in $urlArray) { 27 | 28 | # if one file is missing "Not Compliant" it will trigger the remediation 29 | $lastPart = $url.Split("/")[-1] 30 | $lastPart 31 | 32 | $fileexists = Get-childitem -Path "C:\Users\$User\AppData\Roaming\Microsoft\Templates\$lastPart" -ErrorAction SilentlyContinue #| fl * 33 | if ($fileexists) { 34 | "Compliant" 35 | exit 0 36 | } 37 | else { 38 | "Not Compliant" 39 | exit 1 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /Intune/proactive remediation/detect and copy outlook template files/detection-sync-outlook-template-single-file.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script syncs Outlook Template File to users / detection (single file) 4 | .DESCRIPTION 5 | This script requires Intune Proactive Remediation Task 6 | .NOTES 7 | Author: Thiago Beier 8 | Email: thiago.beier@gmail.com 9 | Blog: https://thebeier.com 10 | LinkedIn: https://www.linkedin.com/in/tbeier/ 11 | Twitter: https://twitter.com/thiagobeier 12 | Date: 04/19/2023 13 | Version: 1.0 14 | #> 15 | 16 | Clear-Host 17 | 18 | # C:\Users\username\AppData\Roaming\Microsoft\Templates 19 | # Detection 20 | 21 | $Users = $env:USERNAME 22 | $oftFileName = "PROJECT - TOPIC .oft" #update here the file name, same file name on %appdata% , azure blob storage url path 23 | 24 | ForEach($User in $Users) { 25 | 26 | $fileexists = Get-childitem -Path "C:\Users\$User\AppData\Roaming\Microsoft\Templates\$oftFileName" -ErrorAction SilentlyContinue #| fl * 27 | if ($fileexists) { 28 | "Compliant" 29 | exit 0 30 | } 31 | else { 32 | "Not Compliant" 33 | exit 1 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Intune/proactive remediation/detect and copy outlook template files/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Intune/proactive remediation/detect and copy outlook template files/image1.png -------------------------------------------------------------------------------- /Intune/proactive remediation/detect and copy outlook template files/remediation-sync-outlook-template-multiple-files.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script syncs Outlook Template Files to users / remediation (multiple files) 4 | .DESCRIPTION 5 | This script requires Intune Proactive Remediation Task 6 | .NOTES 7 | Author: Thiago Beier 8 | Email: thiago.beier@gmail.com 9 | Blog: https://thebeier.com 10 | LinkedIn: https://www.linkedin.com/in/tbeier/ 11 | Twitter: https://twitter.com/thiagobeier 12 | Date: 04/19/2023 13 | Version: 1.0 14 | #> 15 | 16 | Clear-Host 17 | 18 | $url1 = "https://YOUR-STORAGE-URL/PROJECT - TOPIC1.oft" 19 | $url2 = "https://YOUR-STORAGE-URL/PROJECT - TOPIC2.oft" 20 | $url3 = "https://YOUR-STORAGE-URL/PROJECT - TOPIC .oft" 21 | #$url4 = "https://www.example.com/file3.txt" 22 | 23 | # Add the URLs to an array 24 | $urlArray = @($url1, $url2, $url3) #if you add $url4 in URLS add it at the array as well => $urlArray = @($url1, $url2, $url3, $url4) 25 | 26 | $User = $env:USERNAME 27 | 28 | # Loop through the URLs and download the contents 29 | foreach ($url in $urlArray) { 30 | $filename = (Split-Path -Leaf $url) 31 | $outputPath = "C:\Users\$User\AppData\Roaming\Microsoft\Templates\" 32 | "Copying File $filename" 33 | Invoke-WebRequest -Uri $url -OutFile $outputPath\$filename 34 | } 35 | -------------------------------------------------------------------------------- /Intune/proactive remediation/detect and copy outlook template files/remediation-sync-outlook-template-single-file.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This script syncs Outlook Template File to users / remediation (single file) 4 | .DESCRIPTION 5 | This script requires Intune Proactive Remediation Task 6 | .NOTES 7 | Author: Thiago Beier 8 | Email: thiago.beier@gmail.com 9 | Blog: https://thebeier.com 10 | LinkedIn: https://www.linkedin.com/in/tbeier/ 11 | Twitter: https://twitter.com/thiagobeier 12 | Date: 04/19/2023 13 | Version: 1.0 14 | #> 15 | 16 | Clear-Host 17 | 18 | Start-Sleep -Seconds 5 19 | 20 | # Detection 21 | 22 | $Users = $env:USERNAME 23 | $oftFileName = "PROJECT - TOPIC .oft" #update here the file name, same file name on %appdata% , azure blob storage url path 24 | 25 | ForEach($User in $Users) { 26 | 27 | $fileexists = Get-childitem -Path "C:\Users\$User\AppData\Roaming\Microsoft\Templates\$oftFileName" -ErrorAction SilentlyContinue #| fl * 28 | if ($fileexists) { 29 | write-output "File Found" } else { 30 | write-output "File not found. Copying file" 31 | # Remediation 32 | # copy Outlook Template from Azure blob storage 33 | $OutlookTemplateFile = "https://YOUR-STORAGE-URL/$oftFileName" 34 | Invoke-WebRequest -Uri $OutlookTemplateFile -OutFile "C:\Users\$User\AppData\Roaming\Microsoft\Templates\$oftFileName" 35 | 36 | } 37 | 38 | 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /Intune/proactive remediation/detect and remove drawio/detect-drawio.ps1: -------------------------------------------------------------------------------- 1 | #detect drawio 2 | 3 | try 4 | { 5 | $detecta = Get-AppxPackage | select * | where-object {$_ -like "*draw.io.draw.ioDiagrams*"} 6 | if ($detecta) { 7 | "removing $($detecta.Name)" 8 | #Remove-AppxPackage -AllUsers -Package $detecta.PackageFullName 9 | #echo "detected" | out-file detected.txt 10 | exit 1 11 | } else { 12 | "do nothing" 13 | #echo "not found" | out-file not-found.txt 14 | exit 0 15 | } 16 | } 17 | catch{ 18 | $errMsg = $_.Exception.Message 19 | Write-Error $errMsg 20 | exit 1 21 | } -------------------------------------------------------------------------------- /Intune/proactive remediation/detect and remove drawio/remediate-drawio.ps1: -------------------------------------------------------------------------------- 1 | #remove drawio 2 | 3 | try 4 | { 5 | $detecta = Get-AppxPackage | select * | where-object {$_ -like "*draw.io.draw.ioDiagrams*"} 6 | if ($detecta) { 7 | "removing $($detecta.Name)" 8 | Remove-AppxPackage -AllUsers -Package $detecta.PackageFullName 9 | echo "removed" | out-file removed.txt 10 | exit 0 11 | } else { 12 | "do nothing" 13 | exit 0 14 | } 15 | } 16 | catch{ 17 | $errMsg = $_.Exception.Message 18 | Write-Error $errMsg 19 | exit 1 20 | } -------------------------------------------------------------------------------- /Other/0/CMTrace.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/0/CMTrace.exe -------------------------------------------------------------------------------- /Other/0/autopilot-reg.ps1: -------------------------------------------------------------------------------- 1 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Confirm:$false 2 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 3 | New-Item -Type Directory -Path "C:\HWID" 4 | Set-Location -Path "C:\HWID" 5 | $env:Path += ";C:\Program Files\WindowsPowerShell\Scripts" 6 | Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned 7 | Install-Script -Name Get-WindowsAutopilotInfo -Force -Confirm:$false 8 | Get-WindowsAutopilotInfo -OutputFile "$env:COMPUTERNAME.csv" -------------------------------------------------------------------------------- /Other/0/working-dir.ps1: -------------------------------------------------------------------------------- 1 | #region : Set CLI to the Workgin Dir and Log 2 | $FullDate = Get-Date -Format "yyyy-MM-dd" 3 | $FullDate.Split("-") 4 | $DTYear = $FullDate.Split("-")[0] 5 | $DTMonth = $FullDate.Split("-")[1] 6 | $DTDay = $FullDate.Split("-")[2] 7 | $WorkDir = "C:\temp\$DTYear\$DTMonth\$DTDay" 8 | 9 | # Test to see if folder [$LogFolder] exists 10 | if (Test-Path -Path $WorkDir) { 11 | "Working dir folder exists!" 12 | } else { 13 | "Working dir folder doesn't exist. Creating." 14 | New-Item -ItemType Directory -Path $WorkDir 15 | } 16 | Set-Location "$WorkDir" 17 | #endregion -------------------------------------------------------------------------------- /Other/1/1 - Read domain list from CSV and export email domain data.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/1/1 - Read domain list from CSV and export email domain data.docx -------------------------------------------------------------------------------- /Other/1/import-csv-search-for-email-domains.ps1: -------------------------------------------------------------------------------- 1 | ############################################################################################################################################################################################################################################### 2 | # Author Thiago Beier thiago.beier@gmail.com 3 | # Version: 1.0 - 2020-03-09 4 | # Read all upn, email address, proxysmtpaddress and primarysmtpaddress from a CSV file and breaks into current users with specified domain name and users with different upn who have email on specified domain 5 | # Toronto, CANADA 6 | # Email: thiago.beier@gmail.com 7 | # https://www.linkedin.com/in/tbeier/ 8 | # https://twitter.com/thiagobeier 9 | # thiagobeier.wordpress.com 10 | ############################################################################################################################################################################################################################################### 11 | #Redirects all powershell output to a file 12 | 13 | #define reprot folder 14 | $reportfolder = "report1" 15 | 16 | #start transcript 17 | Start-Transcript -Path "C:\temp\$reportfolder\Log-$(get-date -format 'MM_dd_yyyy-HH-mm').txt" 18 | 19 | #domain list file 20 | $domainlist1 = Get-Content .\domainlist.txt 21 | 22 | #loop 23 | foreach ($domain in $domainlist1) { 24 | write-host $domain -ForegroundColor Blue 25 | #define variable for the search domain 26 | $searchdomain = $domain 27 | write-host "users with domain:" $searchdomain "in PrimarySmtpAddress" -ForegroundColor Yellow 28 | $find1 = (import-csv .\test-fulllist.csv | Where-Object {$_.primarysmtpaddress -like "*@$searchdomain*"}).count 29 | write-host $find1 -ForegroundColor Red 30 | #export current users on specified domain 31 | import-csv .\test-fulllist.csv | Where-Object {$_.primarysmtpaddress -like "*@$searchdomain*"} | select DisplayName,UserPrincipalName,PrimarySmtpAddress | Export-Csv -NoTypeInformation -Encoding UTF8 C:\Temp\$reportfolder\current-users-on-$searchdomain.csv 32 | 33 | #list users at different domains with this domain on proxysmtpaddress 34 | write-host "users with domain:" "$searchdomain" "in EmailAddress that are from other domains" -ForegroundColor cyan 35 | $find2 = (import-csv .\test-fulllist.csv | Where-Object {$_.emailaddresses -like "*$searchdomain*" -and $_.UserPrincipalName -notlike "*$searchdomain*"} | select UserPrincipalName).count #| measure 36 | #export users on specified domain with different upn 37 | import-csv .\test-fulllist.csv | Where-Object {$_.emailaddresses -like "*$searchdomain*" -and $_.UserPrincipalName -notlike "*$searchdomain*"} | select DisplayName,UserPrincipalName,PrimarySmtpAddress | Export-Csv -NoTypeInformation -Encoding UTF8 C:\Temp\$reportfolder\$searchdomain.csv 38 | write-host "found" $find2 "users with" $domain "as proxysmtpaddress" -ForegroundColor Green 39 | } -------------------------------------------------------------------------------- /Other/1/readme.md: -------------------------------------------------------------------------------- 1 | Read domain list from CSV and export email domain data. 2 | 3 | Hi there 4 | 5 | After working on a project where we had 30 domains to be migrated over between 6 | two different Office 365 tenants I picked one of the tasks and I'm posting there 7 | the challenge and its PowerShell script that might be helpful  8 | 9 | We had to identity from an exported email domains data with DisplayName, 10 | UserPrincipalName, PrimarySmtpAddress and EmailAddresses 11 | 12 |   13 | 14 | The** test-fulllist.csv** file it's an output from the following powershell 15 | commad / export 16 | 17 |   18 | 19 |   20 | 21 | **PowerShell** 22 | 23 | Get-Mailbox -ResultSize Unlimited \|**Select-Object** DisplayName,UserPrincipalName,PrimarySmtpAddress, \@{Name=“EmailAddresses”;Expression={\$_.EmailAddresses \|Where-Object {\$_.PrefixString -ceq “smtp”} \| **ForEach**-Object {\$_.SmtpAddress}}} \| **Export-CSV** C:\\temp\\test-fulllist.csv 24 | 25 |   26 | 27 | **Main Script** 28 | 29 |   30 | 31 |   32 | 33 | **PowerShell** 34 | 35 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#  36 | 37 | \# Author Thiago Beier thiago.beier\@gmail.com     38 | 39 | \# Version: 1.0 - 2020-03-09    40 | 41 | \# Read all upn, email address, proxysmtpaddress and primarysmtpaddress from a CSV file and breaks into current users with specified domain name and users with different upn who have email on specified domain  42 | 43 | \# Toronto, CANADA     44 | 45 | \# Email: thiago.beier\@gmail.com   46 | 47 | \# https://www.linkedin.com/in/tbeier/   48 | 49 | \# https://twitter.com/thiagobeier  50 | 51 | \# thiagobeier.wordpress.com  52 | 53 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#    54 | 55 | \#Redirects all powershell output to a file   56 | 57 |   58 | 59 | \#define reprot folder  60 | 61 | \$reportfolder = "report1"  62 | 63 |   64 | 65 | \#start transcript  66 | 67 | **Start-Transcript** -Path "C:\\temp\\\$reportfolder\\Log-\$(get-date -format 'MM_dd_yyyy-HH-mm').txt"  68 | 69 |   70 | 71 | \#domain list file  72 | 73 | \$domainlist1 = **Get-Content** .\\domainlist.txt  74 | 75 |   76 | 77 | \#loop  78 | 79 | **foreach** (\$domain **in** \$domainlist1) {  80 | 81 | write-host \$domain -ForegroundColor Blue  82 | 83 | \#define variable for the search domain  84 | 85 | \$searchdomain = \$domain  86 | 87 | write-host "users with domain:" \$searchdomain "in PrimarySmtpAddress" -ForegroundColor Yellow  88 | 89 | \$find1 = (**import-csv** .\\test-fulllist.csv \| Where-Object {\$_.primarysmtpaddress -like "\*\@\$searchdomain\*"}).count  90 | 91 | write-host \$find1 -ForegroundColor Red  92 | 93 | \#export current users on specified domain  94 | 95 | **import-csv** .\\test-fulllist.csv \| Where-Object {\$_.primarysmtpaddress -like "\*\@\$searchdomain\*"} \| **select** DisplayName,UserPrincipalName,PrimarySmtpAddress \| **Export-Csv** -NoTypeInformation -Encoding UTF8 C:\\Temp\\\$reportfolder\\current-users-on-\$searchdomain.csv  96 | 97 |   98 | 99 | \#list users at different domains with this domain on proxysmtpaddress  100 | 101 | write-host "users with domain:" "\$searchdomain" "in EmailAddress that are from other domains" -ForegroundColor cyan  102 | 103 | \$find2 = (**import-csv** .\\test-fulllist.csv \| Where-Object {\$_.emailaddresses -like "\*\$searchdomain\*" -and \$_.UserPrincipalName -notlike "\*\$searchdomain\*"} \| **select** UserPrincipalName).count \#\| measure  104 | 105 | \#export users on specified domain with different upn  106 | 107 | **import-csv** .\\test-fulllist.csv \| Where-Object {\$_.emailaddresses -like "\*\$searchdomain\*" -and \$_.UserPrincipalName -notlike "\*\$searchdomain\*"} \| **select** DisplayName,UserPrincipalName,PrimarySmtpAddress \| **Export-Csv** -NoTypeInformation -Encoding UTF8 C:\\Temp\\\$reportfolder\\\$searchdomain.csv  108 | 109 | write-host "found" \$find2 "users with" \$domain "as proxysmtpaddress" -ForegroundColor Green  110 | 111 | }  112 | 113 |   114 | 115 |   116 | 117 | **Stop-Transcript** 118 | 119 |   120 | -------------------------------------------------------------------------------- /Other/10/10 - Monitor a folder size on real-time every hour.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/10/10 - Monitor a folder size on real-time every hour.docx -------------------------------------------------------------------------------- /Other/10/monitor-folder-size.ps1: -------------------------------------------------------------------------------- 1 | #Powershell 2 | #Monitor Folder Growth 3 | #Displays result in MB and in GB 4 | #Author: Thiago Beier Toronto, ON Canada 5 | #E-mail: thiago.beier@gmail.com 6 | #May-2018 7 | #DFS , FileServer, Folder Size 8 | 9 | do{ 10 | $result = "{0:N2} MB" -f ((Get-ChildItem $folder -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1MB) 11 | $result1 = "{0:N2} GB" -f ((Get-ChildItem $folder -Recurse | Measure-Object -Property Length -Sum -ErrorAction Stop).Sum / 1GB) 12 | 13 | $hour = (Get-Date).ToString() 14 | 15 | write-host $hour -ForegroundColor Yellow 16 | write-host $result -ForegroundColor Green 17 | write-host $result1 -ForegroundColor Cyan 18 | 19 | start-sleep -Seconds 3600 #validate status every 1 hour 20 | #start-sleep -Seconds 5 #test every 15 seconds 21 | }until($infinity) 22 | -------------------------------------------------------------------------------- /Other/10/readme.md: -------------------------------------------------------------------------------- 1 | Monitor a folder size on real-time every hour. 2 | 3 | This script monitor a folder in real-time and displays its growth every one hour 4 | (default). 5 | 6 | You can customize the folder, the interval and also add the Send-Mailmessage 7 | function https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view= 8 | 9 | This is a handy script to be used when you're transfering or syncing a large 10 | amount of data between servers and you need to know how the growth is going. 11 | 12 | We had a specific customer where we defined a narrow bandwidth 13 | consumption  during the day and full during after hours. 14 | 15 | Tip: 16 | 17 | copy during the day up to 5 MBPS 18 | 19 | roobcopy "E:\\DFS\\source" "\\\\downstream-srv01\\e\$\\DFS\\target" /IPG:146 /E 20 | /B /COPYALL /R:6 /W:5 /XD DfsrPrivate /TEE /LOG+:e:\\preseed-folder01.log  21 | 22 | copy after hours unlimited with /MT (multi thread parameter) 23 | 24 | roobcopy "E:\\DFS\\source" "\\\\downstream-srv01\\e\$\\DFS\\target" /E /B 25 | /COPYALL /MT /R:6 /W:5 /XD DfsrPrivate /TEE /LOG+:e:\\preseed-folder01.log  26 | 27 | [robocopy](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy) documentation 28 | 29 |   30 | 31 | **PowerShell** 32 | 33 | \#Powershell  34 | 35 | \#Monitor Folder Growth   36 | 37 | \#Displays result in MB and in GB  38 | 39 | \#Author: Thiago Beier Toronto, ON Canada  40 | 41 | \#E-mail: thiago.beier\@gmail.com  42 | 43 | \#May-2018  44 | 45 | \#DFS , FileServer, Folder Size  46 | 47 |   48 | 49 | **do**{  50 | 51 | \$result = "{0:N2} MB" -f ((**Get-ChildItem** \$folder -Recurse \| **Measure-Object** -Property Length -Sum -ErrorAction Stop).Sum / 1MB)  52 | 53 | \$result1 = "{0:N2} GB" -f ((**Get-ChildItem** \$folder -Recurse \| **Measure-Object** -Property Length -Sum -ErrorAction Stop).Sum / 1GB)  54 | 55 |   56 | 57 | \$hour = (**Get-Date**).ToString()  58 | 59 |   60 | 61 | write-host \$hour -ForegroundColor Yellow  62 | 63 | write-host \$result -ForegroundColor Green  64 | 65 | write-host \$result1 -ForegroundColor Cyan  66 | 67 |   68 | 69 |     **start-sleep** -Seconds 3600 \#validate status every 1 hour      70 | 71 |     \#start-sleep -Seconds 5 \#test every 15 seconds  72 | 73 | }**until**(\$infinity)  74 | 75 |   76 | 77 |   78 | 79 |   80 | 81 | Output: 82 | 83 |   84 | 85 |   86 | 87 | **PowerShell** 88 | 89 | 7/14/2018 12:23:53 AM   90 | 91 | 1,872.01 MB   92 | 93 | 1.83 GB   94 | 95 | 7/14/2018 12:33:53 AM   96 | 97 | 1,872.01 MB   98 | 99 | 1.83 GB  100 | 101 |   102 | 103 |   104 | -------------------------------------------------------------------------------- /Other/11/11 - ADFS - Export.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/11/11 - ADFS - Export.docx -------------------------------------------------------------------------------- /Other/11/export-adfs-relyingpartytrust-issuancetransformrules.ps1: -------------------------------------------------------------------------------- 1 | ########################################################################################### 2 | #Author Thiago Beier thiago.beier@gmail.com 3 | #Version: 1.0 - 2019-08-15 4 | #Export ADFS relying party trust 5 | #Export each separately on c:\users\YOUR-USERNAME\Documents\adfs\ folder 6 | #OS Version and Build: Microsoft Windows Server 2016 Standard , 10.0.14393 N/A Build 14393 7 | #Tested with SCCM Version: 1902 8 | #Toronto,CANADA 9 | #email: thiago.beier@gmail.com 10 | #https://www.linkedin.com/in/tbeier/ 11 | ########################################################################################### 12 | 13 | $exportpath = "$env:USERPROFILE\Documents\adfs" 14 | 15 | #creates c:\users\YOUR-USERNAME\Documents\adfs\ folder if doesn't exist 16 | 17 | If(!(test-path "$exportpath")) 18 | { 19 | New-Item -ItemType Directory -Force -Path $exportpath 20 | 21 | #list all ADFS relying party trust and export its IssuanceTransformRules 22 | 23 | $listappsname = Get-AdfsRelyingPartyTrust | select name 24 | #$listappsname 25 | foreach ($appname in $listappsname) { 26 | $fullappname = $appname.Name 27 | write-host $appname.Name -ForegroundColor Green 28 | (Get-AdfsRelyingPartyTrust -Name "$fullappname").IssuanceTransformRules | Out-File "$exportpath\$fullappname.txt" 29 | } 30 | 31 | } else { write-host -ForegroundColor Yellow "Directory Exists" } 32 | 33 | #export ADFS Endpoints 34 | Get-AdfsEndpoint | fl * > "$exportpath\AdfsEndpoint.txt" 35 | 36 | #export ADFS Claims Description 37 | Get-AdfsClaimDescription | fl * > "$exportpath\AdfsClaimDescription.txt" 38 | 39 | #export ADFS Certificates 40 | Get-AdfsCertificate | fl * > "$exportpath\AdfsCertificates.txt" 41 | 42 | #export ADFS Authentication Provider 43 | Get-AdfsAuthenticationProvider | fl * > "$exportpath\AdfsAuthenticationProvider.txt" 44 | 45 | #export ADFS AttributeStore 46 | Get-AdfsAttributeStore | fl * > "$exportpath\AdfsAttributeStore.txt" 47 | 48 | #export ADFS Access Control Policy 49 | Get-AdfsAccessControlPolicy | fl * > "$exportpath\AdfsAccessControlPolicy.txt" 50 | 51 | #Show on Screen 52 | 53 | $adfsversion = (Get-Item C:\Windows\ADFS\Microsoft.IdentityServer.ServiceHost.exe).VersionInfo.ProductVersion 54 | write-host "" 55 | write-host "ADFS Version:" -ForegroundColor White 56 | $showver = write-host -ForegroundColor Cyan $adfsversion 57 | 58 | 59 | -------------------------------------------------------------------------------- /Other/11/media/8864ecc17598dda58b7cb96db293f622.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/11/media/8864ecc17598dda58b7cb96db293f622.png -------------------------------------------------------------------------------- /Other/11/readme.md: -------------------------------------------------------------------------------- 1 | ADFS - Export 2 | 3 | Hi There, 4 | 5 | Export /Import ADFS Claim Rules for your relying party trusts to a text 6 | file UncategorizedSometimes you might be bored creating similar/same claim rules 7 | accross your enviornments. I regularly use this script to export customer's 8 | environment when we're doing inventory & assessements. 9 | 10 | Below method will quickly help you export your claim rules and apply to 11 | different relying party trust 12 | 13 | Tip: 14 | 15 | If you customer has Azure enabled and they can use Enterprise Applications you 16 | should try to move all applications that support SSO (single sign-on) to Azure 17 | Enterprise Applications to give users access 18 | through [https://myapps.microsoft.com](https://myapps.microsoft.com/) or  19 | 20 | **Step1** : Export to a text file  21 | 22 | **PowerShell** 23 | 24 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     25 | 26 | \#Author Thiago Beier thiago.beier\@gmail.com     27 | 28 | \#Version: 1.0 - 2019-08-15    29 | 30 | \#Export ADFS relying party trust  31 | 32 | \#Export each separately on c:\\users\\YOUR-USERNAME\\Documents\\adfs\\ folder   33 | 34 | \#OS Version and Build: Microsoft Windows Server 2016 Standard , 10.0.14393 N/A Build 14393  35 | 36 | \#Tested with SCCM Version: 1902   37 | 38 | \#Toronto,CANADA     39 | 40 | \#email: thiago.beier\@gmail.com   41 | 42 | \#https://www.linkedin.com/in/tbeier/   43 | 44 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#  45 | 46 |   47 | 48 | \$exportpath = "\$env:USERPROFILE\\Documents\\adfs"  49 | 50 |   51 | 52 | \#creates c:\\users\\YOUR-USERNAME\\Documents\\adfs\\ folder if doesn't exist  53 | 54 |   55 | 56 | **If**(!(**test-path** "\$exportpath"))  57 | 58 | {  59 | 60 |     **New-Item** -ItemType Directory -Force -Path \$exportpath  61 | 62 |   63 | 64 |     \#list all ADFS relying party trust and export its IssuanceTransformRules  65 | 66 |   67 | 68 |     \$listappsname = Get-AdfsRelyingPartyTrust \| **select** name  69 | 70 |     \#\$listappsname  71 | 72 |     **foreach** (\$appname **in** \$listappsname) {  73 | 74 |     \$fullappname = \$appname.Name  75 | 76 |     write-host \$appname.Name -ForegroundColor Green  77 | 78 |     (Get-AdfsRelyingPartyTrust -Name "\$fullappname").IssuanceTransformRules \| Out-File "\$exportpath\\\$fullappname.txt"  79 | 80 |     }  81 | 82 |   83 | 84 | } **else** { write-host -ForegroundColor Yellow "Directory Exists" }  85 | 86 |   87 | 88 | \#export ADFS Endpoints  89 | 90 | Get-AdfsEndpoint \| **fl** \* \> "\$exportpath\\AdfsEndpoint.txt"  91 | 92 |   93 | 94 | \#export ADFS Claims Description  95 | 96 | Get-AdfsClaimDescription \| **fl** \* \> "\$exportpath\\AdfsClaimDescription.txt"  97 | 98 |   99 | 100 | \#export ADFS Certificates  101 | 102 | Get-AdfsCertificate \| **fl** \* \> "\$exportpath\\AdfsCertificates.txt"  103 | 104 |   105 | 106 | \#export ADFS Authentication Provider  107 | 108 | Get-AdfsAuthenticationProvider \| **fl** \* \> "\$exportpath\\AdfsAuthenticationProvider.txt"  109 | 110 |   111 | 112 | \#export ADFS AttributeStore  113 | 114 | Get-AdfsAttributeStore \| **fl** \* \> "\$exportpath\\AdfsAttributeStore.txt"  115 | 116 |   117 | 118 | \#export ADFS Access Control Policy  119 | 120 | Get-AdfsAccessControlPolicy \| **fl** \* \> "\$exportpath\\AdfsAccessControlPolicy.txt"  121 | 122 |   123 | 124 | \#Show on Screen  125 | 126 |   127 | 128 | \$adfsversion = (**Get-Item** C:\\Windows\\ADFS\\Microsoft.IdentityServer.ServiceHost.exe).VersionInfo.ProductVersion   129 | 130 | write-host ""  131 | 132 | write-host "ADFS Version:" -ForegroundColor White   133 | 134 | \$showver = write-host -ForegroundColor Cyan \$adfsversion  135 | 136 |   137 | 138 |   139 | 140 |   141 | 142 | Files after exported 143 | 144 | ![https://gallery.technet.microsoft.com/site/view/file/225105/1/adfs.png](media/8864ecc17598dda58b7cb96db293f622.png) 145 | -------------------------------------------------------------------------------- /Other/12/12 - Creates a Standard User for ADDS and Office365 Management.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/12/12 - Creates a Standard User for ADDS and Office365 Management.docx -------------------------------------------------------------------------------- /Other/12/create-defaul-user-adds-o365-v1.1.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019 by Thiago Beier (thiago.beier@gmail.com) 2 | # Toronto, CANADA V1.1 3 | # All Rights Reserved. 4 | # This Script Creates a standard user for management at local AD (Active Directory) and at Office 365 5 | # Used for on-boarding process and also for correct missing steps on on-boarding processes 6 | 7 | # //this script asks for your Offcie 365 tenant credentials 8 | # //It shoudl be run from local ADDS - Global catalog with internet access to https://portal.office.com 9 | 10 | # //please run the following before you start using this script 11 | # Install-Module MSOnline 12 | # Install-Module AzureAD 13 | 14 | # //Be aware if the users exists in one side it won't be overwrited, deleted, removed or re-added 15 | # //It only creates the standard user support@tenantdomainname where is missing 16 | 17 | # // you have the variable $OU = "CN=Managed Service Accounts,DC=MYDOMAIN,DC=LOCAL" - that's your default OU or container for Managed Service Accounts 18 | # // you have the variable -UserPrincipalName "$Username@mydomain.local" - that corresponds to you local ADDS FQDN - you might need make changes if you have Azure AD connect in your deployment 19 | 20 | #connect to tenant 21 | 22 | $domainname = Read-Host -Prompt "Enter your tenant domain" 23 | $AdminName = Read-Host -Prompt "Enter your tenant admin user" #// we have a standard user support on each Office 365 tenant and this user should exists on each local ADDS 24 | Read-Host -Prompt "Enter your tenant admin user password" -AsSecureString | ConvertFrom-SecureString | Out-File cred.txt 25 | $Pass = Get-Content cred.txt | ConvertTo-SecureString 26 | $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $AdminName, $Pass 27 | Import-Module MSOnline 28 | 29 | #DN for your internal domain name / FQDN 30 | $addsprefix = Read-Host -Prompt "Enter your ADDS prefix i.e.: tecbis.local type tecbis" 31 | $addssuffix = Read-Host -Prompt "Enter your ADDS suffix i.e.: tecbis.local type local" 32 | $OU = "CN=Managed Service Accounts,DC=$addsprefix,DC=$addssuffix" 33 | write-host $OU -ForegroundColor Cyan 34 | 35 | $upnadds = Read-Host -Prompt "Enter your routed domain UPN i.e.: thebeier.com" #if you use this please comment lind #93 and uncoment line #94 36 | 37 | # Import active directory module for running AD cmdlets 38 | Import-Module activedirectory 39 | 40 | #Store the data from ADUsers.csv in the $ADUsers variable 41 | $Firstname = "GMSAdmin" 42 | $Lastname = "Account" 43 | $ADUsers = "GMSAdmin" 44 | 45 | #Loop through each row containing user details in the CSV file 46 | foreach ($User in $ADUsers) 47 | { 48 | #generate user password from DinoPass - awesome project with strong password generator 49 | 50 | $URI = "http://www.dinopass.com/password/strong" 51 | $HTML = Invoke-WebRequest -Uri $URI 52 | $html.content 53 | 54 | 55 | #Read user data from each field in each row and assign the data to a variable as below 56 | 57 | $Username = $User 58 | #$Password = $User.password 59 | $Firstname = $User 60 | #$Lastname = $User.lastname 61 | $OU = "CN=Managed Service Accounts,DC=$addsprefix,DC=$addssuffix" 62 | $email = $User 63 | $streetaddress = $User.streetaddress 64 | $city = $User.city 65 | $zipcode = $User.zipcode 66 | $state = $User.state 67 | $country = $User.country 68 | $telephone = $User.telephone 69 | $jobtitle = $User.jobtitle 70 | $company = $User.company 71 | $department = $User.department 72 | $Password = $html.content 73 | 74 | 75 | #Check to see if the user already exists in AD 76 | if (Get-ADUser -F {SamAccountName -eq $Username}) 77 | { 78 | #If user does exist, give a warning 79 | Write-Warning "A user account with username $Username already exist in Active Directory." 80 | } 81 | else 82 | { 83 | #User does not exist then proceed to create the new user account 84 | write-host $Username -ForegroundColor Yellow 85 | write-host $Firstname -ForegroundColor Yellow 86 | write-host $OU -ForegroundColor Yellow 87 | 88 | #warning 89 | Write-Warning "A user account with username $Username doesn't exist in Active Directory." 90 | Write-Warning "Creating the user: $Username in Active Directory." 91 | 92 | #Account will be created in the OU provided by the $OU variable read from the CSV file 93 | New-ADUser -Name $Username -SamAccountName $Username -UserPrincipalName "$Username@$addsprefix.$addssuffix" -Path $OU -AccountPassword (convertto-securestring $Password -AsPlainText -Force) -ChangePasswordAtLogon $false 94 | #New-ADUser -Name $Username -SamAccountName $Username -UserPrincipalName "$Username@$upnadds" -Path $OU -AccountPassword (convertto-securestring $Password -AsPlainText -Force) -ChangePasswordAtLogon $false 95 | 96 | Get-ADUser -Identity $Username | Set-ADUser -PasswordNeverExpires:$true 97 | Get-ADUser -Identity $Username | Set-ADUser -CannotChangePassword:$true 98 | 99 | } 100 | 101 | #Check to see if the user already exists in Office365 102 | $msolupn = "$Username@$domainname" 103 | $upn = $msolupn 104 | $User = Get-MsolUser -UserPrincipalName $upn -ErrorAction SilentlyContinue 105 | $User 106 | If ($User -ne $Null) { 107 | Write-Warning "A user account with username $upn already exist in Office 365." 108 | } Else { 109 | Write-host "A user account with username $upn doesn't exist in Office 365" -ForegroundColor Yellow 110 | 111 | #create office365 account 112 | 113 | $msolupn = "$Username@$domainname" 114 | $msolupn 115 | 116 | New-MsolUser -UserPrincipalName $msolupn -DisplayName $Username -FirstName $Username 117 | Add-MsolRoleMember -RoleName “Company Administrator” –RoleMemberEmailAddress $msolupn 118 | Set-MsolUserPassword -userPrincipalName $msolupn -NewPassword $Password -ForceChangePassword $false 119 | 120 | } 121 | 122 | Write-Host "#################### Username ###########################" -ForegroundColor Green 123 | #write-host "Username" 124 | write-host $Username -ForegroundColor Yellow 125 | Write-Host "" 126 | 127 | Write-Host "#################### Password ###########################" -ForegroundColor Green 128 | #Write-Host "Password" 129 | write-host $Password -ForegroundColor Yellow 130 | Write-Host "" 131 | 132 | } -------------------------------------------------------------------------------- /Other/12/media/08ade24a2e2cbf8418b00970c6cda5b0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/12/media/08ade24a2e2cbf8418b00970c6cda5b0.jpg -------------------------------------------------------------------------------- /Other/12/media/6c7fc23622588e40946ffc4c0096e699.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/12/media/6c7fc23622588e40946ffc4c0096e699.jpg -------------------------------------------------------------------------------- /Other/12/media/ea7e7d13f200a57df00c069f9f9b38f6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/12/media/ea7e7d13f200a57df00c069f9f9b38f6.jpg -------------------------------------------------------------------------------- /Other/13/13 - Retrieve all Office365 users and compare their UPN (userprincipalname) with ADDS.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/13/13 - Retrieve all Office365 users and compare their UPN (userprincipalname) with ADDS.docx -------------------------------------------------------------------------------- /Other/13/check-msoluser-adds-upn.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | #Author Thiago Beier thiago.beier@gmail.com 3 | #Version: 1.0 4 | #Toronto,CANADA 5 | #Powershell Functions To Manager Office 365, Exchange Online, SharePoint and Skype for Business. 6 | #Before using this please check the PowerShell modules required 7 | ################################################################################ 8 | 9 | #Redirects all powershell output to a file 10 | Start-Transcript C:\temp\default-output-upn.txt 11 | 12 | del C:\temp\users-upn-in-adds.txt 13 | del C:\temp\upn-found-inadds.txt 14 | del 15 | 16 | $users = Get-MSOLUser -All | select UserPrincipalName 17 | foreach ($upn in $users) { 18 | $upn = ($upn -split 'UserPrincipalname=')[1] -split '}' 19 | $upn = ($upn -split '@')[0] 20 | Write-Host User UPN $upn found in Active Directory .... -ForegroundColor Green 21 | 22 | ForEach ($addslogin in $upn) { 23 | try 24 | { 25 | #change here to set an specific OU 26 | #get-aduser -SearchBase "OU=SBSUsers,OU=Users,OU=MyBusiness,DC=yourdomain,DC=local" -SearchScope Subtree $addslogin -Properties * |select enabled,name,displayname,lastlogondate >> C:\temp\users-upn-in-adds.txt 27 | get-aduser $addslogin -Properties * | select name,displayname,samaccountname,lastlogondate >> C:\temp\users-upn-in-adds.txt 28 | $addslogin >> C:\temp\upn-found-inadds.txt 29 | 30 | } 31 | Catch { 32 | write-Host User UPN $addslogin was not found in Active Directory ... -ForegroundColor red 33 | $addslogin >> C:\temp\upn-notfound-inadds.txt 34 | 35 | } 36 | } 37 | 38 | } 39 | 40 | 41 | Stop-Transcript -------------------------------------------------------------------------------- /Other/13/media/1de63d04039b5e3715995530f7886f13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/13/media/1de63d04039b5e3715995530f7886f13.png -------------------------------------------------------------------------------- /Other/13/media/80bd1c9728c717fafeebdea9b1f752cc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/13/media/80bd1c9728c717fafeebdea9b1f752cc.png -------------------------------------------------------------------------------- /Other/13/readme.md: -------------------------------------------------------------------------------- 1 | Retrieve all Office365 users and compare their UPN (userprincipalname) with ADDS 2 | 3 | This powershell script runs better on Powershell ISE where you can make any 4 | needed changes to its outputs. 5 | 6 | It retrieves all MS Office 365 users from a tenant domain and check if their UPN 7 | (UserPrincipalName) exist in ADDS (Active Directory Domain Services) 8 | 9 | You can use this before enabling local ADDS synchronization with Office 365 10 | using Azure AD connect to make sure if users from Office365 tenant already exist 11 | by Displayname 12 | 13 |   14 | 15 | ![https://gallery.technet.microsoft.com/scriptcenter/site/view/file/186969/1/msol%20adds%20check2.PNG](media/1de63d04039b5e3715995530f7886f13.png) 16 | 17 | It creates output files at c:\\temp\\ to follow up what's hapenning 18 | 19 |   20 | 21 | ![https://gallery.technet.microsoft.com/scriptcenter/site/view/file/186970/1/msol%20adds%20check3.PNG](media/80bd1c9728c717fafeebdea9b1f752cc.png) 22 | 23 |   24 | 25 | You can try my other 26 | published [script ](https://gallery.technet.microsoft.com/scriptcenter/Office365-Exchange-bb504cce?redir=0)to 27 | connect to your tenant using a function.  28 | 29 | Tips: 30 | 31 | 1. you can disable powershel transcript output to a file by changing the 32 | following 33 | 34 | \#Start-Transcript C:\\temp\\default-powershell-output.txt 35 | 36 | \#Stop-Transcript  37 | 38 |   39 | 40 | 2. go to line 27 and change the following to FILTER by an specific OU 41 | (organizational unit) 42 | 43 | \#change here to set an specific OU\#get-aduser -SearchBase 44 | "OU=SBSUsers,OU=Users,OU=MyBusiness,DC=yourdomain,DC=local" -SearchScope Subtree 45 | \$addslogin -Properties \* \|select enabled,name,displayname,lastlogondate \>\> 46 | C:\\temp\\users-upn-in-adds.txt  47 | 48 |   49 | 50 |   51 | 52 |   53 | 54 | **PowerShell** 55 | 56 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#   57 | 58 | \#Author Thiago Beier thiago.beier\@gmail.com   59 | 60 | \#Version: 1.1 - 2019-05-07  61 | 62 | \#Removed extra del command after del C:\\temp\\upn-found-inadds.txt  line  63 | 64 | \#Toronto,CANADA   65 | 66 | \#Powershell Functions To Manager Office 365, Exchange Online, SharePoint and Skype for Business.   67 | 68 | \#Before using this please check the PowerShell modules required   69 | 70 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#   71 | 72 |   73 | 74 | \#Redirects all powershell output to a file  75 | 76 | **Start-Transcript** C:\\temp\\default-output-upn.txt  77 | 78 |   79 | 80 | **del** C:\\temp\\users-upn-**in**-adds.txt  81 | 82 | **del** C:\\temp\\upn-found-inadds.txt  83 | 84 |   85 | 86 | \$users = Get-MSOLUser -All \| **select** UserPrincipalName  87 | 88 | **foreach** (\$upn **in** \$users) {  89 | 90 | \$upn = (\$upn -split 'UserPrincipalname=')[1] -split '}'  91 | 92 | \$upn = (\$upn -split '\@')[0]  93 | 94 | Write-Host User \$upn found **in** Active Directory .... -ForegroundColor Green  95 | 96 |   97 | 98 | **ForEach** (\$addslogin **in** \$upn) {  99 | 100 | **try**   101 | 102 | {  103 | 104 | \#change here to set an specific OU  105 | 106 | \#get-aduser -SearchBase "OU=SBSUsers,OU=Users,OU=MyBusiness,DC=yourdomain,DC=local" -SearchScope Subtree \$addslogin -Properties \* \|select enabled,name,displayname,lastlogondate \>\> C:\\temp\\users-upn-in-adds.txt  107 | 108 | get-aduser \$addslogin -Properties \* \| **select** name,displayname,samaccountname,lastlogondate \>\> C:\\temp\\users-upn-**in**-adds.txt  109 | 110 | \$addslogin \>\> C:\\temp\\upn-found-inadds.txt  111 | 112 |   113 | 114 | }  115 | 116 | **Catch** {  117 | 118 |         write-Host User \$addslogin was not found **in** Active Directory ... -ForegroundColor red   119 | 120 |         \$addslogin \>\> C:\\temp\\upn-notfound-inadds.txt  121 | 122 |         }  123 | 124 |     }  125 | 126 |   127 | 128 | }  129 | 130 |   131 | 132 |   133 | 134 | **Stop-Transcript**  135 | 136 |   137 | -------------------------------------------------------------------------------- /Other/14/14 - Configure your 1st ADDS Server.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/14/14 - Configure your 1st ADDS Server.docx -------------------------------------------------------------------------------- /Other/14/1st-server-ADDS.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | 3 | Attention: copy and paste it on the Powershell ISE and run each Steps separately 4 | 5 | This is a script to be executed in two parts (Step1 and Step2) 6 | Where on Step1: it configures your server name, IP address, network mas and gateway and restarts it. 7 | And on Step2: it configures the ADDS parameters such as domain name, netbios name, DataBasePath, ForestMode and DomainMode . 8 | 9 | The script waits for an network connection named "Ethernet" , please change it according to your need 10 | 11 | .LINK 12 | http://exchangeserverpro.com/powershell-script-health-check-report-exchange-2010 13 | 14 | .NOTES 15 | Written by: Thiago Beier 16 | 17 | Find me on: 18 | 19 | * Our Community Blog: http://www.msbsb.com.br/ 20 | * Twitter: https://twitter.com/thiagobeier 21 | * LinkedIn: https://br.linkedin.com/in/tbeier 22 | 23 | 24 | For more Windows Server tips, tricks and news check out MSBSB. 25 | 26 | * Website: http://www.msbsb.com.br 27 | * Twitter: https://twitter.com/MS_BSB 28 | * Facebook: https://www.facebook.com/comunidademsbsb 29 | 30 | For Help with Tzutil check this link https://technet.microsoft.com/en-us/library/hh825053.aspx 31 | 32 | Change Log 33 | V1.00, 10/07/2013 - Initial version 34 | 35 | #> 36 | 37 | #Step1 38 | $novonome = Read-Host "Enter the name of the server" 39 | $nomedominio = Read-Host "Enter the name of the domain" -ForegroundColor Yellow 40 | $nomenetbios = Read-Host "Enter the netbios name" 41 | $ipaddr = Read-Host "Enter the ip address" 42 | $mygw = Read-Host "Enter the gateway" 43 | $dnsaddr = Read-Host "Enter the dns ip address" 44 | 45 | #configura o timezone ; sets up the timeZone 46 | tzutil /s "E. South America Standard Time" 47 | 48 | #renomeia o computador ; rename the computername 49 | Rename-Computer -NewName $novonome 50 | 51 | #configura endereço IP na interface de nome "Ethernet" ; sets up an IP address to the "Ethernet" named adapter 52 | New-NetIPAddress -IPAddress $ipaddr -InterfaceAlias Ethernet -DefaultGateway $mygw -AddressFamily IPv4 -PrefixLength 24 53 | 54 | #configura o cliente DNS ; sets up the DNS client 55 | Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses $dnsaddr 56 | 57 | #Instala as features de gerencia de ADDS e GroupPolicy ; Installs ADDS and GroupPolicy tools 58 | Install-WindowsFeature –Name AD-Domain-Services,GPMC –IncludeManagementTools 59 | 60 | #reinicia o computador para validar as configurações realizadas ; restart computer to make new changes 61 | Restart-Computer 62 | 63 | 64 | 65 | #After the reboot continue with the next code to configure you ADDS on this server 66 | 67 | #Step2 68 | 69 | [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') 70 | $nomedominio = [Microsoft.VisualBasic.Interaction]::InputBox('Enter the Domain name', 'Domain Name') 71 | $nomenetbios = [Microsoft.VisualBasic.Interaction]::InputBox('Enter the Netbios name', 'Netbios Name') 72 | Install-ADDSForest -Domainname $nomedominio -CreateDNSDelegation:$False -DataBasePath “C:\NTDS” -ForestMode Win2012 -DomainMode Win2012 -DomainNetBiosName $nomenetbios -InstallDNS:$True -LogPath “C:\NTDS” -SysvolPath “C:\NTDS\Sysvol” 73 | Restart-Computer 74 | -------------------------------------------------------------------------------- /Other/14/readme.md: -------------------------------------------------------------------------------- 1 | Configure your 1st ADDS Server 2 | 3 | This script will help you on setting up your 1st Windows Server running ADDS in 4 | a LABORATORY or PRODUCTION environment. 5 | 6 | To use this script, download it and run it as Administrator on Powershell ISE. 7 | 8 | To run it copy and paste the code and run each Steps separately. 9 | 10 | Feel free to change and improve it when needed and to distribute it according to 11 | the Gallery and Technet Copyright. 12 | 13 |   14 | 15 | **PowerShell** 16 | 17 | \<\#  18 | 19 |   20 | 21 | Attention: copy and paste it on the Powershell ISE and run each Steps separately  22 | 23 |   24 | 25 | This is a script to be executed in two parts (Step1 and Step2)   26 | 27 | Where on Step1: it configures your server name, IP address, network mas and gateway and restarts it.  28 | 29 | And on Step2: it configures the ADDS parameters such as domain name, netbios name, DataBasePath, ForestMode and DomainMode .  30 | 31 |   32 | 33 | The script waits for an network connection named "Ethernet" , please change it according to your need  34 | 35 |   36 | 37 | .LINK  38 | 39 | http://exchangeserverpro.com/powershell-script-health-check-report-exchange-2010  40 | 41 |   42 | 43 | .NOTES  44 | 45 | Written by: Thiago Beier  46 | 47 |   48 | 49 | Find me on:  50 | 51 |   52 | 53 | \* Our Community Blog: http://www.msbsb.com.br/  54 | 55 | \* Twitter:    https://twitter.com/thiagobeier  56 | 57 | \* LinkedIn:    https://br.linkedin.com/in/tbeier  58 | 59 |   60 | 61 |   62 | 63 | For more Windows Server tips, tricks and news check out MSBSB.  64 | 65 |   66 | 67 | \* Website:    http://www.msbsb.com.br  68 | 69 | \* Twitter:    https://twitter.com/MS_BSB  70 | 71 | \* Facebook: https://www.facebook.com/comunidademsbsb  72 | 73 |   74 | 75 | For Help with Tzutil check this link https://technet.microsoft.com/en-us/library/hh825053.aspx  76 | 77 |   78 | 79 | Change Log  80 | 81 | V1.00, 10/07/2013 - Initial version  82 | 83 |   84 | 85 | \#\>  86 | 87 |   88 | 89 | \#Step1  90 | 91 | \$novonome = **Read-Host**  "Enter the name of the server"  92 | 93 | \$nomedominio = **Read-Host** "Enter the name of the domain" -ForegroundColor Yellow    94 | 95 | \$nomenetbios = **Read-Host** "Enter the netbios name"  96 | 97 | \$ipaddr = **Read-Host** "Enter the ip address"  98 | 99 | \$mygw = **Read-Host** "Enter the gateway"  100 | 101 | \$dnsaddr = **Read-Host** "Enter the dns ip address"  102 | 103 |   104 | 105 | \#configura o timezone ; sets up the timeZone  106 | 107 | tzutil /s "E. South America Standard Time"  108 | 109 |   110 | 111 | \#renomeia o computador ; rename the computername  112 | 113 | Rename-Computer -NewName \$novonome  114 | 115 |   116 | 117 | \#configura endereço IP na interface de nome "Ethernet" ; sets up an IP address to the "Ethernet" named adapter  118 | 119 | New-NetIPAddress -IPAddress \$ipaddr -InterfaceAlias Ethernet -DefaultGateway \$mygw -AddressFamily IPv4 -PrefixLength 24  120 | 121 |   122 | 123 | \#configura o cliente DNS ; sets up the DNS client  124 | 125 | Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses \$dnsaddr  126 | 127 |   128 | 129 | \#Instala as features de gerencia de ADDS e GroupPolicy ; Installs ADDS and GroupPolicy tools  130 | 131 | Install-WindowsFeature –Name AD-Domain-Services,GPMC –IncludeManagementTools  132 | 133 |   134 | 135 | \#reinicia o computador para validar as configurações realizadas ; restart computer to make new changes  136 | 137 | Restart-Computer  138 | 139 |   140 | 141 |   142 | 143 |   144 | 145 | \#After the reboot continue with the next code to configure you ADDS on this server  146 | 147 |   148 | 149 | \#Step2  150 | 151 |   152 | 153 | [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')   154 | 155 | \$nomedominio = [Microsoft.VisualBasic.Interaction]::InputBox('Enter the Domain name', 'Domain Name')   156 | 157 | \$nomenetbios = [Microsoft.VisualBasic.Interaction]::InputBox('Enter the Netbios name', 'Netbios Name')   158 | 159 | Install-ADDSForest -Domainname \$nomedominio -CreateDNSDelegation:\$False -DataBasePath “C:\\NTDS” -ForestMode Win2012 -DomainMode Win2012 -DomainNetBiosName \$nomenetbios -InstallDNS:\$True -LogPath “C:\\NTDS” -SysvolPath “C:\\NTDS\\Sysvol”  160 | 161 | Restart-Computer  162 | 163 |   164 | -------------------------------------------------------------------------------- /Other/15/15 - Office365, Exchange, SharePoint and Skype For Business Powershell Profile Script.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/15/15 - Office365, Exchange, SharePoint and Skype For Business Powershell Profile Script.docx -------------------------------------------------------------------------------- /Other/15/Microsoft.PowerShell_profile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/15/Microsoft.PowerShell_profile.ps1 -------------------------------------------------------------------------------- /Other/15/media/d961b416f5f01948d8671d9f910b026c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/15/media/d961b416f5f01948d8671d9f910b026c.png -------------------------------------------------------------------------------- /Other/16/16 - Export All Distribution Lists Information and its members to CSV.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/16/16 - Export All Distribution Lists Information and its members to CSV.docx -------------------------------------------------------------------------------- /Other/16/o365-export-DL-v1.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019 by Thiago Beier (thiago.beier@gmail.com) 2 | # Toronto, CANADA V1.0 3 | # All Rights Reserved. 4 | # This Script Export All Distribution Groups and Members List to CSV 5 | # CSV file syntax "All-Distribution-Group-Members-$(get-date -f yyyy-MM-dd).csv" where "-$(get-date -f yyyy-MM-dd)" add the date with 2019-02-03 format in the file name 6 | # There's an option to enable / disable the PowerShell Transcript (uncomment the #start-transcript and #stop-transcript on line #9 and #30 7 | # It generates the files under c:\users\%username% folder (user running the script) and be aware that if you're running as administrator sometimes it goes to c:\users\administrator instead your current user 8 | $dateandtime = (get-date -f yyyy-MM-dd-mm-ss) 9 | #start-transcript c:\users\%usrename%\transcript-$dateandtime.txt 10 | 11 | $Result=@() 12 | $groups = Get-DistributionGroup -ResultSize Unlimited 13 | $totalmbx = $groups.Count 14 | $i = 1 15 | $groups | ForEach-Object { 16 | Write-Progress -activity "Processing $_.DisplayName" -status "$i out of $totalmbx completed" 17 | $group = $_ 18 | Get-DistributionGroupMember -Identity $group.Name -ResultSize Unlimited | ForEach-Object { 19 | $member = $_ 20 | $Result += New-Object PSObject -property @{ 21 | GroupName = $group.DisplayName 22 | Member = $member.Name 23 | EmailAddress = $member.PrimarySMTPAddress 24 | RecipientType= $member.RecipientType 25 | }} 26 | $i++ 27 | } 28 | $Result | Export-CSV "All-Distribution-Group-Members-$dateandtime.csv" -NoTypeInformation -Encoding UTF8 29 | #end 30 | #stop-transcript -------------------------------------------------------------------------------- /Other/16/readme.md: -------------------------------------------------------------------------------- 1 | Export All Distribution Lists Information and its members to CSV 2 | 3 | Hi again, 4 | 5 | Today's script runs after you connect on Office 365 Tenant Domain and need to 6 | export all DL (Distribution List) information (Name) and its contents (users by 7 | mailbox type). 8 | 9 | Run this script for assessment, inventoroy or a backup during any changes you're 10 | planning to make on your Tenant Domain. 11 | 12 | Use the previous script I posted to manage your Office 365 Tenant 13 | Domains  14 | 15 | Feel free to reach me anytime to share your experiences on using this script. 16 | 17 | Always evaluate this script on a sandbox environment if possible. 18 | 19 | Reach MSFT Technet Forums and Documentation to double check commands and its 20 | syntaxes because sometimes a few commands get its switches updated or new are 21 | introduced and you could expirience issues when running them. 22 | 23 |   24 | 25 |   26 | 27 | **PowerShell** 28 | 29 | \#  Copyright (C) 2019 by Thiago Beier (thiago.beier\@gmail.com)    30 | 31 | \#  Toronto, CANADA V1.0  32 | 33 | \#  All Rights Reserved.    34 | 35 | \#  This Script Export All Distribution Groups and Members List to CSV  36 | 37 | \#  CSV file syntax "All-Distribution-Group-Members-\$(get-date -f yyyy-MM-dd).csv" where "-\$(get-date -f yyyy-MM-dd)" add the date with 2019-02-03 format in the file name  38 | 39 | \#  There's an option to enable / disable the PowerShell Transcript (uncomment the \#start-transcript and \#stop-transcript on line \#9 and \#30   40 | 41 | \#  It generates the files under c:\\users\\%username% folder (user running the script) and be aware that if you're running as administrator sometimes it goes to c:\\users\\administrator instead your current user  42 | 43 | \$dateandtime = (**get-date** -f yyyy-MM-dd-mm-ss)  44 | 45 | \#start-transcript c:\\users\\%usrename%\\transcript-\$dateandtime.txt  46 | 47 |   48 | 49 | \$Result=\@()  50 | 51 | \$groups = Get-DistributionGroup -ResultSize Unlimited  52 | 53 | \$totalmbx = \$groups.Count  54 | 55 | \$i = 1   56 | 57 | \$groups \| **ForEach**-Object {  58 | 59 | **Write-Progress** -activity "Processing \$_.DisplayName" -status "\$i out of \$totalmbx completed"  60 | 61 | \$group = \$_  62 | 63 | Get-DistributionGroupMember -Identity \$group.Name -ResultSize Unlimited \| **ForEach**-Object {  64 | 65 | \$member = \$_  66 | 67 | \$Result += **New-Object** PSObject -property \@{   68 | 69 | GroupName = \$group.DisplayName  70 | 71 | Member = \$member.Name  72 | 73 | EmailAddress = \$member.PrimarySMTPAddress  74 | 75 | RecipientType= \$member.RecipientType  76 | 77 | }}  78 | 79 | \$i++  80 | 81 | }  82 | 83 | \$Result \| **Export-CSV** "All-Distribution-Group-Members-\$dateandtime.csv" -NoTypeInformation -Encoding UTF8  84 | 85 | \#end  86 | 87 | \#stop-transcript 88 | 89 |   90 | -------------------------------------------------------------------------------- /Other/17/17 - Check if a DL (Distribution List) exists on Office 365.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/17/17 - Check if a DL (Distribution List) exists on Office 365.docx -------------------------------------------------------------------------------- /Other/17/O365-check-DL-group-exists-v1.ps1: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019 by Thiago Beier (thiago.beier@gmail.com) 2 | # Toronto, CANADA V1.0 - All Rights Reserved. 3 | # 4 | # This Script Export All Distribution Groups and Members List to CSV 5 | # You can have your file from TXT or CSV to load all Distribution Lists you need to check 6 | # Make sure you have the c:\work\ directory created where you have the files dl.csv or dl.txt depending on your set up for this run 7 | # Uncomment the line #16 and comment the line #18 if you want to get content from a TXT file ; Uncomment the line #18 and comment the line #16 if you want to get content from a CSV file 8 | # There's an option to enable / disable the PowerShell Transcript (uncomment the #start-transcript and #stop-transcript on line #12 and #48 9 | # It generates the files under c:\users\%username% folder (user running the script) and be aware that if you're running as administrator sometimes it goes to c:\users\administrator instead your current user 10 | # 11 | $dateandtime = (get-date -f yyyy-MM-dd-mm-ss) 12 | #start-transcript c:\users\%usrename%\transcript-df-group-exist-$dateandtime.txt 13 | 14 | # Import the CSV and setup additional variables 15 | 16 | #Get-Content c:\work\dl.txt | foreach-object { 17 | 18 | Import-Csv c:\work\dl.csv | foreach-object { 19 | 20 | #Variable Attributes created from file 21 | 22 | $name = $_.DLName 23 | 24 | $usercheck = $null 25 | 26 | # check if username exists already in AD 27 | 28 | $groupcheck = Get-DistributionGroup -Identity $name 29 | 30 | # Check search result to see if it's Null and then create the user 31 | 32 | If ($groupcheck -eq $null) { 33 | 34 | Write-Host "Group Check Completed - " + $_.DLName + " doesn't exist" `n`r -ForegroundColor Green 35 | write-host "Creating this group" $_.DLName -ForegroundColor Cyan 36 | New-DistributionGroup -Name $_.Displayname -Displayname $_.Displayname -Alias $_.Alias -PrimarySMTPAddress $_.email 37 | 38 | } 39 | 40 | # If it's not null, print out to screen 41 | 42 | Else { Write-Host "User: "$_.DLName "already exists!"`n`r -ForegroundColor Red} 43 | 44 | } 45 | 46 | 47 | #end 48 | #stop-transcript -------------------------------------------------------------------------------- /Other/17/readme.md: -------------------------------------------------------------------------------- 1 | Check if a DL (Distribution List) exists on Office 365 2 | 3 | Hi again, 4 | 5 | Today's script runs after you connect on Office 365 Tenant Domain and need to 6 | check if all DL (Distribution List) exists under your Tenant. 7 | 8 | Run this script for assessment, inventoroy or a backup during any changes you're 9 | planning to make on your Tenant Domain. 10 | 11 | Use the previous script I posted to manage your Office 365 Tenant 12 | Domains  13 | 14 | You can use the previous script to export all Distribution List to have them as 15 | a backup, export before as well. 16 | 17 | Link to Export DL 18 | script  19 | 20 | Feel free to reach me anytime to share your experiences on using this script. 21 | 22 | Always evaluate this script on a sandbox environment if possible. 23 | 24 | Reach MSFT Technet Forums and Documentation to double check commands and its 25 | syntaxes because sometimes a few commands get its switches updated or new are 26 | introduced and you could expirience issues when running them. 27 | 28 |   29 | 30 | **PowerShell** 31 | 32 | \#  Copyright (C) 2019 by Thiago Beier (thiago.beier\@gmail.com)     33 | 34 | \#  Toronto, CANADA V1.0 - All Rights Reserved.     35 | 36 | \#  37 | 38 | \#  This Script Export All Distribution Groups and Members List to CSV   39 | 40 | \#  You can have your file from TXT or CSV to load all Distribution Lists you need to check  41 | 42 | \#  Make sure you have the c:\\work\\ directory created where you have the files dl.csv or dl.txt depending on your set up for this run  43 | 44 | \#  Uncomment the line \#16 and comment the line \#18 if you want to get content from a TXT file ; Uncomment the line \#18 and comment the line \#16 if you want to get content from a CSV file  45 | 46 | \#  There's an option to enable / disable the PowerShell Transcript (uncomment the \#start-transcript and \#stop-transcript on line \#12 and \#48   47 | 48 | \#  It generates the files under c:\\users\\%username% folder (user running the script) and be aware that if you're running as administrator sometimes it goes to c:\\users\\administrator instead your current user   49 | 50 | \#  51 | 52 | \$dateandtime = (**get-date** -f yyyy-MM-dd-mm-ss)   53 | 54 | \#start-transcript c:\\users\\%usrename%\\transcript-df-group-exist-\$dateandtime.txt   55 | 56 |   57 | 58 | \# Import the CSV and setup additional variables  59 | 60 |   61 | 62 | \#Get-Content c:\\work\\dl.txt \| foreach-object {   63 | 64 |   65 | 66 | **Import-Csv** c:\\work\\dl.csv \| **foreach**-object {  67 | 68 |   69 | 70 | \#Variable Attributes created from file  71 | 72 |   73 | 74 | \$name = \$_.DLName  75 | 76 |   77 | 78 | \$usercheck = \$null  79 | 80 |   81 | 82 | \# check if username exists already in AD  83 | 84 |   85 | 86 | \$groupcheck = Get-DistributionGroup -Identity \$name  87 | 88 |   89 | 90 | \# Check search result to see if it's Null and then create the user  91 | 92 |   93 | 94 | **If** (\$groupcheck -eq \$null) {  95 | 96 |   97 | 98 | Write-Host "Group Check Completed - " + \$_.DLName + " doesn't exist" \`n\`**r** -ForegroundColor Green  99 | 100 | write-host "Creating this group" \$_.DLName -ForegroundColor Cyan  101 | 102 | New-DistributionGroup -Name \$_.Displayname -Displayname \$_.Displayname -Alias \$_.Alias -PrimarySMTPAddress \$_.email  103 | 104 |   105 | 106 | }  107 | 108 |   109 | 110 | \# If it's not null, print out to screen  111 | 112 |   113 | 114 | **Else** { Write-Host "User: "\$_.DLName "already exists!"\`n\`**r** -ForegroundColor Red}  115 | 116 |   117 | 118 | }  119 | 120 |   121 | 122 |   123 | 124 | \#end  125 | 126 | \#stop-transcript 127 | 128 |   129 | -------------------------------------------------------------------------------- /Other/18/18 - Office365 & Azure Powershell Management Functions.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/18/18 - Office365 & Azure Powershell Management Functions.docx -------------------------------------------------------------------------------- /Other/18/Microsoft.PowerShell_profile (1).ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/18/Microsoft.PowerShell_profile (1).ps1 -------------------------------------------------------------------------------- /Other/19/19 - SCCM Inventory and Assessment Scripts.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/19/19 - SCCM Inventory and Assessment Scripts.docx -------------------------------------------------------------------------------- /Other/19/readme.md: -------------------------------------------------------------------------------- 1 | SCCM Inventory and Assessment Scripts 2 | 3 | Hi again, 4 | This powershell script runs on Powershell and Powershell ISE. 5 | It exports SCCM queries, applications and its contents, packages and its 6 | contetns, collections information and all task sequences with its depencies as 7 | well. 8 | Tested with PowerShell ISE and PowerShell on a SCCM 1902 version. 9 | 10 | Files hash 11 | 12 | export-all-sccm-apps.ps1              13 |  16773C6C180AE194B383E2E8B3364AFFA3D280DA32F4F158CA3489F1BF208F2C 14 | export-all-sccm-collection-members.ps1 EF8D227A0AA2B3191A2F2820524C91688FF0980CA9482E6B7708FC34EC045DA4 15 | export-all-sccm-packages.ps1          16 |  319662821C8793C65EA43B23C62A5E98BF058DE92F38C899389FFD9D3D45BE82 17 | export-all-sccm-queries.ps1          18 |   42B17B51F902297F73FCA977B4E87C2FDECEDC9C5023B72C8A357C3519CCF6D6 19 | export-all-sccm-tasksequences.ps1    20 |   C7AAF37C27FE86ED4DA370C7A1EAA8FCA5FEC54297D415F72A8B131684BAB826 21 | 22 |   23 | -------------------------------------------------------------------------------- /Other/19/sccm-exports.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/19/sccm-exports.zip -------------------------------------------------------------------------------- /Other/2/2 - List ADDS (active directory domain services) account summary.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/2/2 - List ADDS (active directory domain services) account summary.docx -------------------------------------------------------------------------------- /Other/2/adds-users-count.ps1: -------------------------------------------------------------------------------- 1 | ############################################################################################################################################################################################################################################### 2 | # Author Thiago Beier thiago.beier@gmail.com 3 | # Version: 1.0 - 2020-03-09 4 | # List sum of total users, total enabled accounts, total disabled accounts in ADDS (you can restrict the search to a specific OU - line 12 and 13 5 | # Toronto, CANADA 6 | # Email: thiago.beier@gmail.com 7 | # https://www.linkedin.com/in/tbeier/ 8 | # https://twitter.com/thiagobeier 9 | # thiagobeier.wordpress.com 10 | ############################################################################################################################################################################################################################################### 11 | 12 | #Get-ADUser -Filter * -SearchBase "OU=Field,OU=Users,OU=Toronto,DC=canada,DC=local" |fl name | measure 13 | $userstotal = Get-ADUser -Filter * -SearchBase "DC=canada,DC=local" |fl name | measure 14 | $usersenabled = Get-ADUser -Filter {Enabled -eq $true} | fl name | measure 15 | $usersdisabled = Get-ADUser -Filter {Enabled -eq $false} | fl name | measure 16 | write-host -ForegroundColor Magenta "########################## ADDS - TGAM - Users Report ###########################" 17 | Write-Host -ForegroundColor Yellow "Total Users" $userstotal.Count 18 | Write-Host -ForegroundColor Green "Enabled Users" $usersenabled.Count 19 | Write-Host -ForegroundColor Cyan "Disabled Users" $usersdisabled.Count 20 | write-host -ForegroundColor Magenta "#################################################################################" -------------------------------------------------------------------------------- /Other/2/readme.md: -------------------------------------------------------------------------------- 1 | List ADDS (active directory domain services) account summary. 2 | 3 | Hi there 4 | 5 | Sometimes we got simply calls to list the following data from ADDS - Active 6 | Directory Domain Users: 7 | 8 | Total Users in ADDS forest / domain 9 | 10 | Total Disabled Users in ADDS forest / domain 11 | 12 | Total Enabled Users in ADDS forest / domain 13 | 14 | In general you can use PowerShell remote to do so or you can connect direct 15 | using RDP (remote desktop services) into a specific DC (Domain Controller) to 16 | pull out this data request. 17 | 18 | If your environment has [JEA - Just Enough 19 | Administration ](https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/overview?view=powershell-7)be 20 | aware of limitations on powershell commands against specified Servers' roles and 21 | features. 22 | 23 |   24 | 25 |   26 | 27 | **PowerShell** 28 | 29 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#  30 | 31 | \# Author Thiago Beier thiago.beier\@gmail.com     32 | 33 | \# Version: 1.0 - 2020-03-09    34 | 35 | \# List sum of total users, total enabled accounts, total disabled accounts in ADDS (you can restrict the search to a specific OU - line 12 and 13  36 | 37 | \# Toronto, CANADA     38 | 39 | \# Email: thiago.beier\@gmail.com   40 | 41 | \# https://www.linkedin.com/in/tbeier/   42 | 43 | \# https://twitter.com/thiagobeier  44 | 45 | \# thiagobeier.wordpress.com  46 | 47 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#    48 | 49 |   50 | 51 | \#Get-ADUser -Filter \* -SearchBase "OU=Field,OU=Users,OU=Toronto,DC=canada,DC=local" \|fl name \| measure  52 | 53 | \$userstotal = Get-ADUser -**Filter** \* -SearchBase "DC=canada,DC=local" \|**fl** name \| measure  54 | 55 | \$usersenabled = Get-ADUser -**Filter** {Enabled -eq \$true} \| **fl** name \| measure  56 | 57 | \$usersdisabled = Get-ADUser -**Filter** {Enabled -eq \$false} \| **fl** name \| measure  58 | 59 | write-host -ForegroundColor Magenta "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\# ADDS - TGAM - Users Report \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#"  60 | 61 | Write-Host -ForegroundColor Yellow "Total Users" \$userstotal.Count  62 | 63 | Write-Host -ForegroundColor Green "Enabled Users" \$usersenabled.Count  64 | 65 | Write-Host -ForegroundColor Cyan "Disabled Users" \$usersdisabled.Count  66 | 67 | write-host -ForegroundColor Magenta "\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#" 68 | 69 |   70 | -------------------------------------------------------------------------------- /Other/20/20 - Check ADDS attributes (email, proxysmtpaddresses).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/20/20 - Check ADDS attributes (email, proxysmtpaddresses).docx -------------------------------------------------------------------------------- /Other/20/check-adds-attributes.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/20/check-adds-attributes.zip -------------------------------------------------------------------------------- /Other/20/media/1966bc0028180a3149d72046727050e9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/20/media/1966bc0028180a3149d72046727050e9.png -------------------------------------------------------------------------------- /Other/20/media/c8a892004ff8f332e363383d0474a277.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/20/media/c8a892004ff8f332e363383d0474a277.png -------------------------------------------------------------------------------- /Other/20/readme.md: -------------------------------------------------------------------------------- 1 | Check ADDS attributes (email, proxysmtpaddresses) 2 | 3 | This powershell script runs better on Powershell ISE where you can make any 4 | needed changes to its outputs. 5 | 6 | It retrieves all ADDS users from with Email and ProxyStmpAddresses set on ADDS 7 | (it's fully useful before you need to enable ADDS sync to Office365 using Azure 8 | AD Connect). 9 | 10 | ![https://gallery.technet.microsoft.com/scriptcenter/site/view/file/186974/1/checkadds-proxyaddress.PNG](media/1966bc0028180a3149d72046727050e9.png) 11 | 12 |   13 | 14 | ![https://gallery.technet.microsoft.com/scriptcenter/site/view/file/186976/1/checkadds-email.PNG](media/c8a892004ff8f332e363383d0474a277.png) 15 | 16 | you can redirect the ELSE output to a TXT file as you can see by removing the 17 | "\#" before \>\>  18 | 19 | \#\>\> C:\\temp\\hasnot.txt  20 | 21 |   22 | 23 | **PowerShell** 24 | 25 | \#Script1  26 | 27 |   28 | 29 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#  30 | 31 | \#Author Thiago Beier thiago.beier\@gmail.com   32 | 33 | \#Version: 1.0   34 | 35 | \#Toronto,CANADA   36 | 37 | \#Powershell Functions To verify if a user has the proxyaddresses attribute set in ADDS  38 | 39 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#  40 | 41 |   42 | 43 |   44 | 45 |   46 | 47 | Import-Module ActiveDirectory  48 | 49 | \$users = Get-ADUser -LDAPFilter "(mail=\*)" -Properties mail,proxyaddresses -ResultSetSize \$null  50 | 51 |   52 | 53 | **foreach**(\$user **in** \$users){  54 | 55 |     **if**(\$user.proxyaddresses -contains "smtp:\$(\$user.mail)"){  56 | 57 |         write-host \$user.name "ProxyAddresses has been set" -ForegroundColor green  58 | 59 | \# \$user.proxyaddresses   60 | 61 |     } **else** {  62 | 63 |         write-host \$user.name "ProxyAddresses has not been set" -ForegroundColor red \#\>\> C:\\temp\\hasnot.txt  64 | 65 |             }  66 | 67 | }  68 | 69 |   70 | 71 | \#end  72 | 73 |   74 | 75 | \#Script2  76 | 77 |   78 | 79 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#  80 | 81 | \#Author Thiago Beier thiago.beier\@gmail.com   82 | 83 | \#Version: 1.0   84 | 85 | \#Toronto,CANADA   86 | 87 | \#Powershell Functions To verify if a user has the Email attribute set in ADDS  88 | 89 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#  90 | 91 |   92 | 93 |   94 | 95 |   96 | 97 | Import-Module ActiveDirectory  98 | 99 | \$users = Get-ADUser -LDAPFilter "(mail=\*)" -Properties userprincipalname,mail,proxyaddresses -ResultSetSize \$null  100 | 101 |   102 | 103 | **foreach**(\$user **in** \$users){  104 | 105 |     **if**(\$user.mail -contains "\$user.userprincipalname"){  106 | 107 |         write-host \$user.name "Email has been set" -ForegroundColor green  108 | 109 | \# \$user.proxyaddresses   110 | 111 |     } **else** {  112 | 113 |         write-host \$user.name "Email has not been set" -ForegroundColor red \#\>\> C:\\temp\\hasnot.txt  114 | 115 |             }  116 | 117 | }  118 | 119 |   120 | 121 | \#end 122 | 123 |   124 | -------------------------------------------------------------------------------- /Other/21/21 - Hyperv-VMM-2012R2-UpdateKBList.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/21/21 - Hyperv-VMM-2012R2-UpdateKBList.docx -------------------------------------------------------------------------------- /Other/21/WS2012R2HypervVMMupdateList.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/21/WS2012R2HypervVMMupdateList.zip -------------------------------------------------------------------------------- /Other/21/readme.md: -------------------------------------------------------------------------------- 1 | Hyperv-VMM-2012R2-UpdateKBList 2 | 3 | This script will download all recomended hotfixes and updates for Windows Server 4 | 2012 and Windows Server 2012 R2 Hyper-V Network Virtualization (HNV) 5 | environments. 6 | 7 | To use this script, download it and run it as Administrator. 8 | 9 | To run it on ISE replace the line "\$dir = Split-Path 10 | \$MyInvocation.MyCommand.Path" by this "\$dir = Split-Path \$scriptpath"Remenber 11 | to allow script execution on 12 | 13 | Powershell by executing this "Set-ExecutionPolicy Unrestricted -Force" 14 | 15 | To see built-in help, try: 16 | 17 | **PowerShell** 18 | 19 | \#  Copyright (C) 2015 by Thiago Beier (thiago.beier\@gmail.com)  20 | 21 | \#  All Rights Reserved.  22 | 23 |   24 | 25 | \#  Updates List for Hyper-v Windows Server 2012 R2 and VMM 2012 R2  26 | 27 | \#  It opens de Explorer.exe on the destination folder "Default is C:\\Download" change according to your environment.  28 | 29 |   30 | 31 | \$userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"  32 | 33 | \$web = **New-Object** System.Net.WebClient  34 | 35 | \$web.Headers.Add("user-agent", \$userAgent)  36 | 37 | \#if ISE run this and comment the line below \$dir = Split-Path \$scriptpath  38 | 39 | \$dir = **Split-Path** \$MyInvocation.MyCommand.Path  40 | 41 | Write-Output \$dir  42 | 43 |   44 | 45 | \# Create the destination folder if it doesn't exist  46 | 47 | \# Specify the path or change it below  48 | 49 | \$destDir = "C:\\Download"  50 | 51 |   52 | 53 | \# Check if the folder exist if not create it   54 | 55 |  **If** (!(**Test-Path** \$destDir)) {  56 | 57 |    **New-Item** -Path \$destDir -ItemType Directory  58 | 59 | }  60 | 61 | **else** {  62 | 63 |    Write-Host "\`n"  64 | 65 |    Write-Host "Directory already exists!" -ForegroundColor "red"  66 | 67 |    Write-Host "\`n"  68 | 69 | }  70 | 71 |   72 | 73 | \# Start the Download  74 | 75 | **Get-Content** \$dir\\urls.txt \|  76 | 77 |     **Foreach**-Object {   78 | 79 |         write-host -ForegroundColor "cyan" "Downloading  " + \$_   80 | 81 |         **try** {  82 | 83 |             \$target = **join-path** \$destDir ([io.path]::getfilename(\$_))  84 | 85 |             \$web.DownloadFile(\$_, \$target)  86 | 87 |         } **catch** {  88 | 89 |             \$_.Exception.Message  90 | 91 |         }  92 | 93 | }   94 | 95 |   96 | 97 | \#Write the completed message  98 | 99 | Write-Host "\`n\`n\`n"  100 | 101 | Write-Host "Download Completed" -foregroundcolor "green"  102 | 103 | Write-Host "\`n\`n\`n"  104 | 105 |   106 | 107 | \#it Opens the destination folder using Explorer.exe  108 | 109 | **ii** \$destDir 110 | 111 |   112 | 113 | urls.txt 114 | -------------------------------------------------------------------------------- /Other/21/urls.txt: -------------------------------------------------------------------------------- 1 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix499560/9600/free/473990_intl_x64_zip.exe 2 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix499706/9600/free/474171_intl_x64_zip.exe 3 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix501145/9600/free/475130_intl_x64_zip.exe 4 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix489670/9600/free/472373_intl_x64_zip.exe 5 | http://hotfixv4.microsoft.com/Windows%208.1/sp1/Fix484400/9600/free/470722_intl_x64_zip.exe 6 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix503456/9600/free/475120_intl_x64_zip.exe 7 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix498065/9600/free/475122_intl_x64_zip.exe 8 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix502524/9600/free/475125_intl_x64_zip.exe 9 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix502515/9600/free/475119_intl_x64_zip.exe 10 | http://download.microsoft.com/download/D/C/9/DC9165BE-7CE1-4714-A250-60A6F1EC7172/Windows8.1-KB2959146-x64.msu 11 | http://download.microsoft.com/download/E/9/F/E9F42D1F-910D-4120-91F4-F0149429B2BE/Windows8.1-KB2967917-x64.msu 12 | http://hotfixv4.microsoft.com/Windows%208.1/Windows%20Server%202012%20R2/sp1/Fix504281/9600/free/476741_intl_x64_zip.exe 13 | http://download.microsoft.com/download/4/8/6/4863950A-2FE5-421F-B66B-719554CC463F/Windows8.1-KB2975719-x64.msu 14 | http://download.microsoft.com/download/D/C/6/DC69B595-9C62-4B31-B154-B3722250D296/Windows8.1-KB3000850-x64.msu 15 | http://download.microsoft.com/download/4/8/6/4863950A-2FE5-421F-B66B-719554CC463F/Windows8.1-KB2979582-x64.msu 16 | http://download.microsoft.com/download/4/8/6/4863950A-2FE5-421F-B66B-719554CC463F/Windows8.1-KB2990532-x64.msu 17 | http://download.microsoft.com/download/4/8/6/4863950A-2FE5-421F-B66B-719554CC463F/Windows8.1-KB2993100-x64.msu 18 | http://download.microsoft.com/download/4/8/6/4863950A-2FE5-421F-B66B-719554CC463F/Windows8.1-KB2993651-x64.msu 19 | http://download.microsoft.com/download/4/8/6/4863950A-2FE5-421F-B66B-719554CC463F/Windows8.1-KB2995004-x64.msu 20 | http://download.microsoft.com/download/E/E/B/EEB9BFAD-82D1-4EFD-BA3C-EAE61DA1C1BC/Windows8-RT-KB2975331-x64.msu 21 | http://download.microsoft.com/download/E/E/B/EEB9BFAD-82D1-4EFD-BA3C-EAE61DA1C1BC/Windows8-RT-KB2993651-x64.msu 22 | http://download.microsoft.com/download/D/C/6/DC69B595-9C62-4B31-B154-B3722250D296/Windows8.1-KB3003057-x64.msu 23 | http://download.microsoft.com/download/D/C/6/DC69B595-9C62-4B31-B154-B3722250D296/Windows8.1-KB3014442-x64.msu 24 | http://download.microsoft.com/download/D/C/6/DC69B595-9C62-4B31-B154-B3722250D296/Windows8.1-KB3016437-x64.msu 25 | https://download.microsoft.com/download/6/3/5/635BE005-CC9A-4A7C-B484-7A592054A479/Windows8.1-KB3185279-x64.msu 26 | https://download.microsoft.com/download/0/E/3/0E303248-4BCD-49CC-A901-0040B055FC3C/Windows8.1-KB3179574-x64.msu 27 | https://download.microsoft.com/download/A/8/6/A8686706-78A3-4AC9-ABD2-64DC20A4581F/Windows8.1-KB3172614-x64.msu 28 | https://download.microsoft.com/download/D/C/7/DC786CD3-FFF1-480D-8721-590552D3E14A/Windows8.1-KB3130944-x64.msu 29 | https://download.microsoft.com/download/6/8/E/68E7017D-3928-4AD0-A823-4D704B040D8F/Windows8.1-KB3130939-x64.msu 30 | https://download.microsoft.com/download/F/D/D/FDDDDF95-6BE8-4AD9-8865-3A38CC78CEF5/Windows8.1-KB3139896-x64.msu 31 | https://download.microsoft.com/download/A/8/6/A8686706-78A3-4AC9-ABD2-64DC20A4581F/Windows8.1-KB3172614-x64.msu -------------------------------------------------------------------------------- /Other/22/22 - SCCM inventory & assessment.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/22/22 - SCCM inventory & assessment.docx -------------------------------------------------------------------------------- /Other/22/sccm-exports (1).zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/22/sccm-exports (1).zip -------------------------------------------------------------------------------- /Other/23/23 - Export SCCM apps, task sequence, collections, queries and packages.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/23/23 - Export SCCM apps, task sequence, collections, queries and packages.docx -------------------------------------------------------------------------------- /Other/23/media/87b509c0498746a736c9d98bc5efcb91.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/23/media/87b509c0498746a736c9d98bc5efcb91.png -------------------------------------------------------------------------------- /Other/23/media/ed54e64edb5ed282c615e33cedf4aedf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/23/media/ed54e64edb5ed282c615e33cedf4aedf.png -------------------------------------------------------------------------------- /Other/23/readme.md: -------------------------------------------------------------------------------- 1 | Export SCCM apps, task sequence, collections, queries and packages. 2 | 3 | This powershell script runs better on Powershell ISE where you can make any 4 | needed changes to its outputs. However it's fully supported on PowerShell. 5 | It retrieves all SCCM applications, packages, queries, collections and task 6 | sequences and its related and dependent packages to a local folde on SCCM 7 | server. 8 | To run the scripts do the following: 9 | 1. download the scripts files (zipped file) 10 | 2. open SCCM console and connect to SCCM using "Connect via Windows Powershell 11 | ISE"  12 | 13 |   14 | 15 | ![https://gallery.technet.microsoft.com/office/site/view/file/226085/1/sccm-powershell-console.PNG](media/ed54e64edb5ed282c615e33cedf4aedf.png) 16 | 17 | Feel free to edit the \$exportpath and \$targetfolder variable on the PowerShell 18 | code within each script 19 | 20 | ![https://gallery.technet.microsoft.com/office/site/view/file/226086/1/scripts-sccm.PNG](media/87b509c0498746a736c9d98bc5efcb91.png) 21 | 22 |   23 | 24 |   25 | 26 | **PowerShell** 27 | 28 | \$exportpath = "D:\\Export"   29 | 30 | \$targetfolder = "\$exportpath\\pkg"   31 | 32 | **if**(!(**Test-Path** -Path \$targetfolder )){   33 | 34 |     **New-Item** -ItemType directory -Path \$targetfolder   35 | 36 |     Write-Host "New folder created" -ForegroundColor Green   37 | 38 | }   39 | 40 | **else**   41 | 42 | {   43 | 44 |   Write-Host "Folder already exists" -ForegroundColor Red   45 | 46 | } 47 | 48 |   49 | -------------------------------------------------------------------------------- /Other/23/sccm-export-scripts.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/23/sccm-export-scripts.zip -------------------------------------------------------------------------------- /Other/24/24.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/24/24.docx -------------------------------------------------------------------------------- /Other/24/readme.md: -------------------------------------------------------------------------------- 1 | Add Multiple Users Exchange Online contacts permission 2 | 3 | This script is going to add permission at user's mailbox for one single manager 4 | at time. 5 | 6 | You can manage you domain and tenant's domains using bulk commands to set 7 | permission to all users in you organization. 8 | 9 | You can improve this script as needed to your own environment, as we have a 10 | large number of tenants and our customer support have to improve their time when 11 | working in a ticket we're developping script to help us. 12 | 13 | 1st : connect to you Office 365 Domain 14 | 15 | If you don't know how to do it check this 16 | script [here](https://gallery.technet.microsoft.com/Office365-Exchange-bb504cce?redir=0) 17 | 18 | Run the Script answer the input data needed and see what happens in real-time. 19 | 20 | Once again, thanks for using this script. 21 | 22 |   23 | 24 | **Enjoy the journey.** 25 | 26 | **Thiago Beier** 27 | 28 |   29 | 30 | **PowerShell** 31 | 32 | \#  Copyright (C) 2017 by Thiago Beier (thiago.beier\@gmail.com)   33 | 34 | \#  Toronto, CANADA V1.0 A  35 | 36 | \#  All Rights Reserved.   37 | 38 | \#  This Script Add Permission for a specific user at users contacts on Office 365 / Exchange Domains  39 | 40 | \#  It requests Office 365 User Domain Admins account and asks for confirmation before running  41 | 42 | \#  It also show each user where permissions are being applied  43 | 44 | \#  At the line 28 there is the GET command to make sure you're connect at the correct Managed Domain  45 | 46 |   47 | 48 | \$manager = **Read-Host** -Prompt 'Input manager full e-mail address with domain'  49 | 50 | write-host -ForegroundColor Yellow "You have entered \$manager as the account to set the permissions"  51 | 52 | \$windowtitle = **Read-Host** -Prompt 'Name this PowershellWindows'  53 | 54 | \$host.ui.RawUI.WindowTitle = “\$windowtitle”  55 | 56 |   57 | 58 | \$message = "You have entered \$manager as the account to set the permissions"  59 | 60 | \$question = 'Are you sure you want to proceed?'  61 | 62 |   63 | 64 | \$choices = **New-Object** Collections.ObjectModel.Collection[Management.Automation.Host.ChoiceDescription]  65 | 66 | \$choices.Add((**New-Object** Management.Automation.Host.ChoiceDescription -ArgumentList '&Yes'))  67 | 68 | \$choices.Add((**New-Object** Management.Automation.Host.ChoiceDescription -ArgumentList '&No'))  69 | 70 |   71 | 72 | \$decision = \$Host.UI.PromptForChoice(\$message, \$question, \$choices, 1)  73 | 74 | **if** (\$decision -eq 0) {  75 | 76 |   Write-Host -backgroundcolor black -foregroundcolor green 'confirmed'  77 | 78 |   79 | 80 |   \$AllMailboxs = Get-Mailbox -Resultsize Unlimited  81 | 82 |   **Foreach** (\$user **in** \$AllMailboxs)   83 | 84 |     { write-host -BackgroundColor red -ForegroundColor yellow "Executing for user \$user"  85 | 86 |         \#Get-MailboxFolderPermission -Identity \$user.Alias }  87 | 88 |         {add-MailboxFolderPermission –identity (\$user.alias+':\\contacts’)  -User \$manager -AccessRights Editor}  89 | 90 |   91 | 92 | } **else** {  93 | 94 |   Write-Host -BackgroundColor Red -ForegroundColor White 'cancelled'  95 | 96 | } 97 | 98 |   99 | -------------------------------------------------------------------------------- /Other/25/connect-o365-win-server.ps1: -------------------------------------------------------------------------------- 1 | ############################################################################################################################################################################################################################################### 2 | 3 | # Author Thiago Beier thiago.beier@gmail.com 4 | 5 | # Version: 1.0 - 2020-04-17 6 | 7 | # Install Office 365, Skype for Business and Microsoft Teams Modules & connect to them. 8 | 9 | # Downloads and installs pre-requisites for Windows 2016 & 2019 Server 10 | 11 | # Downloads and installs pre-requisites for Windows 10 12 | 13 | # Toronto, CANADA 14 | 15 | # Email: thiago.beier@gmail.com 16 | 17 | # https://www.linkedin.com/in/tbeier/ 18 | 19 | # https://twitter.com/thiagobeier 20 | 21 | # thiagobeier.wordpress.com 22 | 23 | ############################################################################################################################################################################################################################################### 24 | 25 | #Uncomment this line if you're setting this up on Windows 2016/2019 Server 26 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 27 | 28 | #Uncoment the following lines to install, update all modules 29 | Install-Module SharePointPnPPowerShellOnline -Force 30 | Install-Module -Name MicrosoftTeams -Force 31 | Install-Module -Name AzureAD -Force 32 | Install-Module MSOnline -Force 33 | Install-Module AzureADPreview -Force 34 | 35 | #Download the .Net 4.8 offline - For windows Server 2016/2019 36 | mkdir -p c:\temp\downloads\ 37 | Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/?linkid=2088631 -OutFile c:\temp\downloads\ndp48-x86-x64-allos-enu.exe 38 | C:\temp\downloads\ndp48-x86-x64-allos-enu.exe 39 | 40 | #Download Skype for business module 41 | Invoke-WebRequest -Uri https://download.microsoft.com/download/2/0/5/2050B39B-4DA5-48E0-B768-583533B42C3B/SkypeOnlinePowerShell.exe -OutFile c:\temp\downloads\SkypeOnlinePowerShell.exe 42 | C:\temp\downloads\SkypeOnlinePowerShell.exe 43 | 44 | #Importing Modules 45 | Import-Module MSOnline 46 | Import-Module MicrosoftTeams 47 | Import-Module SkypeOnlineConnector 48 | Import-Module AzureADPreview 49 | 50 | #Connect Modules (will open one Web Browser for each connection if MFA enabled on O365 tenant) 51 | Connect-MicrosoftTeams 52 | Connect-ExchangeOnline 53 | Connect-AzureAD 54 | Connect-MsolService 55 | 56 | #Connect Skype for Business Online 57 | 58 | $sfbSession = New-CsOnlineSession 59 | Import-PSSession $sfbSession -AllowClobber 60 | Enable-CsOnlineSessionForReconnection -------------------------------------------------------------------------------- /Other/25/connect-o365-win10.ps1: -------------------------------------------------------------------------------- 1 | ############################################################################################################################################################################################################################################### 2 | 3 | # Author Thiago Beier thiago.beier@gmail.com 4 | 5 | # Version: 1.0 - 2020-04-17 6 | 7 | # Install Office 365, Skype for Business and Microsoft Teams Modules & connect to them. 8 | 9 | # Downloads and installs pre-requisites for Windows 2016 & 2019 Server 10 | 11 | # Downloads and installs pre-requisites for Windows 10 12 | 13 | # Toronto, CANADA 14 | 15 | # Email: thiago.beier@gmail.com 16 | 17 | # https://www.linkedin.com/in/tbeier/ 18 | 19 | # https://twitter.com/thiagobeier 20 | 21 | # thiagobeier.wordpress.com 22 | 23 | ############################################################################################################################################################################################################################################### 24 | 25 | #Uncomment this line if you're setting this up on Windows 2016/2019 Server 26 | #[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 27 | 28 | #Uncoment the following lines to install, update all modules 29 | Install-Module SharePointPnPPowerShellOnline -Force 30 | Install-Module -Name MicrosoftTeams -Force 31 | Install-Module -Name AzureAD -Force 32 | Install-Module MSOnline -Force 33 | Install-Module AzureADPreview -Force 34 | 35 | #Download the .Net 4.8 offline - For windows Server 2016/2019 36 | #mkdir -p c:\temp\downloads\ 37 | #Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/?linkid=2088631 -OutFile c:\temp\downloads\ndp48-x86-x64-allos-enu.exe 38 | #C:\temp\downloads\ndp48-x86-x64-allos-enu.exe 39 | 40 | #Download Skype for business module 41 | Invoke-WebRequest -Uri https://download.microsoft.com/download/2/0/5/2050B39B-4DA5-48E0-B768-583533B42C3B/SkypeOnlinePowerShell.exe -OutFile c:\temp\downloads\SkypeOnlinePowerShell.exe 42 | C:\temp\downloads\SkypeOnlinePowerShell.exe 43 | 44 | #Importing Modules 45 | Import-Module MSOnline 46 | Import-Module MicrosoftTeams 47 | Import-Module SkypeOnlineConnector 48 | Import-Module AzureADPreview 49 | 50 | #Connect Modules (will open one Web Browser for each connection if MFA enabled on O365 tenant) 51 | Connect-MicrosoftTeams 52 | Connect-ExchangeOnline 53 | Connect-AzureAD 54 | Connect-MsolService 55 | 56 | #Connect Skype for Business Online 57 | 58 | $sfbSession = New-CsOnlineSession 59 | Import-PSSession $sfbSession -AllowClobber 60 | Enable-CsOnlineSessionForReconnection -------------------------------------------------------------------------------- /Other/26/remove-user-from-a-team.ps1: -------------------------------------------------------------------------------- 1 | ############################################################################################################################################################################################################################################### 2 | # Author Thiago Beier thiago.beier@gmail.com 3 | # Version: 1.0 - 2020-04-22 4 | # 5 | # Search for a user on each Team at Microsoft Teams and remove it from there. 6 | # 7 | # Does not work with you switched your Membership ty into Dynamic at the Office Group (default is assigned) 8 | # 9 | # Toronto, CANADA 10 | # Email: thiago.beier@gmail.com 11 | # https://www.linkedin.com/in/tbeier/ 12 | # https://twitter.com/thiagobeier 13 | # thiagobeier.wordpress.com 14 | ############################################################################################################################################################################################################################################### 15 | 16 | 17 | 18 | #search for a user on each Team and remove it from there 19 | clear 20 | Start-Sleep 3 21 | Start-Transcript -path "Team-Mgmt-Logfile_$((Get-Date).ToString('MM-dd-yyyy-hh-mm-ss')).txt" -NoClobber -IncludeInvocationHeader 22 | $searchuser ="tcat@collabcan.com" 23 | foreach ($team in Get-Team) { 24 | #$team.DisplayName 25 | write-host -ForegroundColor Green "Group:" $team.DisplayName 26 | write-host -ForegroundColor Green "Groupid:" $team.GroupId 27 | foreach ($user in get-teamuser -GroupId $team.GroupId) { 28 | write-host -ForegroundColor Cyan "User:" $user.name 29 | #Get-MsolUser -ObjectId $user.UserId 30 | $email = (Get-MsolUser -ObjectId $user.UserId).userprincipalname 31 | $email 32 | 33 | [bool]$email 34 | if (!$email) {write-host $email -ForegroundColor yellow "string is null or empty" } 35 | else { 36 | write-host -ForegroundColor red $email "has value" 37 | if ($email -eq $searchuser) { 38 | write-host $email -ForegroundColor yellow "USER found! at" $team.DisplayName "Team" 39 | write-host $email -ForegroundColor Magenta "removing USER from this Team" 40 | Remove-TeamUser -GroupId $team.GroupId -User $email 41 | } 42 | } 43 | 44 | } 45 | } 46 | Stop-Transcript 47 | #end this 48 | -------------------------------------------------------------------------------- /Other/27/blog-check-group-allow-create-teams-membership.ps1: -------------------------------------------------------------------------------- 1 | ############################################################################################################################################################################################################################################### 2 | # Author Thiago Beier thiago.beier@gmail.com 3 | # Version: 1.0 - 2020-04-30 4 | # 5 | # Check if an user had been removed from source groups and remove it from security group 6 | # Group A - has users, Group B - has users and those users (from Group A and B are added to Group C) 7 | # This script checks if one of the users had been removed from Group A or B and remove it from Group C 8 | # User can't ever be on Group A and B at the same time (those groups are used for Office 365 license assignment) 9 | # 10 | # Toronto, CANADA 11 | # Email: thiago.beier@gmail.com 12 | # https://www.linkedin.com/in/tbeier/ 13 | # https://twitter.com/thiagobeier 14 | # https://thiagobeier.wordpress.com 15 | 16 | ############################################################################################################################################################################################################################################### 17 | 18 | #Uncomment this line if you're setting this up on Windows 2016/2019 Server 19 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 20 | 21 | #Uncoment the following lines to install, update all modules 22 | Install-Module SharePointPnPPowerShellOnline -Force 23 | Install-Module -Name MicrosoftTeams -Force 24 | Install-Module -Name AzureAD -Force 25 | Install-Module MSOnline -Force 26 | Install-Module AzureADPreview -Force 27 | 28 | #Download the .Net 4.8 offline - For windows Server 2016/2019 29 | mkdir -p c:\temp\downloads\ 30 | Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/?linkid=2088631 -OutFile c:\temp\downloads\ndp48-x86-x64-allos-enu.exe 31 | C:\temp\downloads\ndp48-x86-x64-allos-enu.exe 32 | 33 | #Download Skype for business module 34 | Invoke-WebRequest -Uri https://download.microsoft.com/download/2/0/5/2050B39B-4DA5-48E0-B768-583533B42C3B/SkypeOnlinePowerShell.exe -OutFile c:\temp\downloads\SkypeOnlinePowerShell.exe 35 | C:\temp\downloads\SkypeOnlinePowerShell.exe 36 | 37 | #Importing Modules 38 | Import-Module MSOnline 39 | Import-Module MicrosoftTeams 40 | Import-Module SkypeOnlineConnector 41 | Import-Module AzureADPreview 42 | 43 | #Connect Modules (will open one Web Browser for each connection if MFA enabled on O365 tenant) 44 | Connect-MicrosoftTeams 45 | Connect-ExchangeOnline 46 | Connect-AzureAD 47 | Connect-MsolService 48 | 49 | #Connect Skype for Business Online 50 | 51 | $sfbSession = New-CsOnlineSession 52 | Import-PSSession $sfbSession -AllowClobber 53 | Enable-CsOnlineSessionForReconnection 54 | 55 | 56 | #begin 57 | clear 58 | write-host "" 59 | write-host "" 60 | write-host "" 61 | write-host "" 62 | write-host "" 63 | write-host "" 64 | write-host "" 65 | write-host "" 66 | write-host "" 67 | write-host -ForegroundColor Magenta "Exporting Groups to CSV" 68 | Start-Sleep 10 69 | clear 70 | $sourcefile = "C:\temp\sourcegroups.txt" 71 | $targetfile = "C:\temp\o365_team_mgmt_group_members.txt" 72 | del C:\temp\sourcegroups.txt 73 | del C:\temp\o365_team_mgmt_group_members.txt 74 | (Get-ADGroupMember -Identity E1-collab-lic).samaccountname | Out-File $sourcefile -Append 75 | (Get-ADGroupMember -Identity E3-collab-lic).samaccountname | Out-File $sourcefile -Append 76 | (Get-ADGroupMember -Identity O365_Teams_Mgmt).samaccountname | Out-File $targetfile -Append 77 | $array = Get-Content -Path @("$sourcefile") 78 | $o365mgmtgroup = Get-Content -Path @("$targetfile") 79 | 80 | $group = "O365_Team_Mgmt" 81 | $members = Get-Content .\sourcegroups.txt 82 | 83 | write-host "" 84 | write-host "" 85 | write-host "" 86 | write-host "" 87 | write-host "" 88 | write-host "" 89 | write-host "" 90 | write-host "" 91 | write-host "" 92 | write-host -ForegroundColor Magenta "Checking Groups Membership" 93 | ForEach ($user in $o365mgmtgroup) { 94 | write-host "working on user $user" 95 | If ($members -contains $user) { 96 | Write-Host -ForegroundColor Green "$user exists in the group $_" 97 | } Else { 98 | Write-Host -ForegroundColor Yellow "$user not exists in the group $_" 99 | write-host -ForegroundColor Cyan "Removing user $user from group" 100 | Remove-ADGroupMember -Identity $group -Members $user -Confirm:$false 101 | }} 102 | Start-Sleep 5 -------------------------------------------------------------------------------- /Other/27/readme.md: -------------------------------------------------------------------------------- 1 | **ADDS, Office365 and Teams Management** 2 | 3 | Hi there 4 | 5 | This script is based on 02 security groups used for licensing on Azure AD 6 | 7 | | Group A | Group B | Group C | 8 | |---------------------------------------------|---------------------------------------------|--------------------------------------------------| 9 | | E1-collab-lic | E3-collab-lic | O365_Teams_Mgmt | 10 | | All users with E1 license + Microsoft Teams | All users with E3 license + Microsoft Teams | All members from E1-collab-lic and E3-collab-lic | 11 | | Security - Global | Security – Global | Security – Global | 12 | | License only | License only | Permissions assignment on Teams – check article. | 13 | 14 | All groups are synchronized to Azure AD 15 | 16 | Regards, 17 | 18 | **Thiago 19 | Beier** [https://thiagobeier.wordpress.com](https://thiagobeier.wordpress.com/) 20 | 21 | **Copyright © 2020 Thiago Beier Blog** 22 | -------------------------------------------------------------------------------- /Other/28/Office 365 – Exporting Shared Mailbox Permissions to CSV.ps1: -------------------------------------------------------------------------------- 1 | ############################################################################################################################################################################################################################################### 2 | # Author Thiago Beier thiago.beier@gmail.com 3 | # Version: 1.0 - 2020-05-02 4 | # 5 | # Export all shared mailboxes permissions from Office 365 based on domain name = ProxyAddress 6 | # 7 | # 8 | # Toronto, CANADA 9 | # Email: thiago.beier@gmail.com 10 | # https://www.linkedin.com/in/tbeier/ 11 | # https://twitter.com/thiagobeier 12 | # https://thiagobeier.wordpress.com 13 | 14 | ############################################################################################################################################################################################################################################### 15 | 16 | Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited -Filter {(emailaddresses -like "*thebeier.com") -or (emailaddresses -like "*collabcan.com")} | Get-MailboxPermission | Select Identity, User, Deny, AccessRights, IsInherited| Where {($_.user -ne "NT AUTHORITY\SELF")}| Export-Csv -Path "THEBEIER-NonOwnerPermissions.csv" -NoTypeInformation -------------------------------------------------------------------------------- /Other/28/THEBEIER-NonOwnerPermissions-filtered.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/28/THEBEIER-NonOwnerPermissions-filtered.xlsx -------------------------------------------------------------------------------- /Other/28/THEBEIER-NonOwnerPermissions.csv: -------------------------------------------------------------------------------- 1 | "Identity","User","Deny","AccessRights","IsInherited" 2 | "finance","thiago.beier@thebeier.com","False","FullAccess","False" 3 | "finance","LAMP152\Administrator","True","FullAccess","True" 4 | "finance","LAMP152\Domain Admins","True","FullAccess","True" 5 | "finance","LAMP152\Enterprise Admins","True","FullAccess","True" 6 | "finance","LAMP152\Organization Management","True","FullAccess","True" 7 | "finance","NT AUTHORITY\SYSTEM","False","FullAccess","True" 8 | "finance","NT AUTHORITY\NETWORK SERVICE","False","ReadPermission","True" 9 | "finance","LAMP152\Administrator","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 10 | "finance","LAMP152\Domain Admins","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 11 | "finance","LAMP152\Enterprise Admins","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 12 | "finance","LAMP152\Organization Management","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 13 | "finance","LAMP152\Public Folder Management","False","ReadPermission","True" 14 | "finance","LAMP152\Exchange Servers","False","FullAccess, ReadPermission","True" 15 | "finance","LAMP152\Exchange Trusted Subsystem","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 16 | "finance","LAMP152\Managed Availability Servers","False","ReadPermission","True" 17 | "finance","S-1-5-21-1589316702-2032257147-3807288276-5106","False","ReadPermission","True" 18 | "finance","PRDTSB01\JitUsers","False","ReadPermission","True" 19 | "staff","thiago.beier@thebeier.com","False","FullAccess","False" 20 | "staff","LAMP152\Administrator","True","FullAccess","True" 21 | "staff","LAMP152\Domain Admins","True","FullAccess","True" 22 | "staff","LAMP152\Enterprise Admins","True","FullAccess","True" 23 | "staff","LAMP152\Organization Management","True","FullAccess","True" 24 | "staff","NT AUTHORITY\SYSTEM","False","FullAccess","True" 25 | "staff","NT AUTHORITY\NETWORK SERVICE","False","ReadPermission","True" 26 | "staff","LAMP152\Administrator","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 27 | "staff","LAMP152\Domain Admins","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 28 | "staff","LAMP152\Enterprise Admins","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 29 | "staff","LAMP152\Organization Management","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 30 | "staff","LAMP152\Public Folder Management","False","ReadPermission","True" 31 | "staff","LAMP152\Exchange Servers","False","FullAccess, ReadPermission","True" 32 | "staff","LAMP152\Exchange Trusted Subsystem","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 33 | "staff","LAMP152\Managed Availability Servers","False","ReadPermission","True" 34 | "staff","S-1-5-21-1589316702-2032257147-3807288276-5106","False","ReadPermission","True" 35 | "staff","PRDTSB01\JitUsers","False","ReadPermission","True" 36 | "ops","thiago.beier@thebeier.com","False","FullAccess","False" 37 | "ops","tgermano@collabcan.com","False","FullAccess","False" 38 | "ops","LAMP152\Administrator","True","FullAccess","True" 39 | "ops","LAMP152\Domain Admins","True","FullAccess","True" 40 | "ops","LAMP152\Enterprise Admins","True","FullAccess","True" 41 | "ops","LAMP152\Organization Management","True","FullAccess","True" 42 | "ops","NT AUTHORITY\SYSTEM","False","FullAccess","True" 43 | "ops","NT AUTHORITY\NETWORK SERVICE","False","ReadPermission","True" 44 | "ops","LAMP152\Administrator","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 45 | "ops","LAMP152\Domain Admins","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 46 | "ops","LAMP152\Enterprise Admins","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 47 | "ops","LAMP152\Organization Management","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 48 | "ops","LAMP152\Public Folder Management","False","ReadPermission","True" 49 | "ops","LAMP152\Exchange Servers","False","FullAccess, ReadPermission","True" 50 | "ops","LAMP152\Exchange Trusted Subsystem","False","FullAccess, DeleteItem, ReadPermission, ChangePermission, ChangeOwner","True" 51 | "ops","LAMP152\Managed Availability Servers","False","ReadPermission","True" 52 | "ops","S-1-5-21-1589316702-2032257147-3807288276-5106","False","ReadPermission","True" 53 | "ops","PRDTSB01\JitUsers","False","ReadPermission","True" 54 | -------------------------------------------------------------------------------- /Other/28/media/191e03585a70fe9e2d55b9a500331e83.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/28/media/191e03585a70fe9e2d55b9a500331e83.png -------------------------------------------------------------------------------- /Other/28/media/5247f976b00076a69dcce662205faeda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/28/media/5247f976b00076a69dcce662205faeda.png -------------------------------------------------------------------------------- /Other/28/readme.md: -------------------------------------------------------------------------------- 1 | **Office 365 – Exporting Shared Mailbox Permissions to CSV** 2 | 3 | Hi there 4 | 5 | This script is will filter users by ProxyAddress 6 | 7 | If you have multiple email domains and you need search across all users by Email 8 | Domain Name (ProxyAddres) use the get-mailbox with filtered parameters to pick 9 | the domains you want to. 10 | 11 | Search all shared mailboxes (List them all) 12 | 13 | Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited 14 | 15 | ![](media/191e03585a70fe9e2d55b9a500331e83.png) 16 | 17 | Search shared mailboxes with specific ProxyAddress and export to CSV 18 | 19 | - Collabcan.com 20 | 21 | - Thebeier.com 22 | 23 | Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited -Filter 24 | {(emailaddresses -like "\*thebeier.com") -or (emailaddresses -like 25 | "\*collabcan.com")} \| 26 | 27 | Get-MailboxPermission \| Select Identity, User, Deny, AccessRights, 28 | IsInherited\| Where {(\$_.user -ne "NT AUTHORITY\\SELF")}\| Export-Csv -Path 29 | "sharedmailboxes-NonOwnerPermissions.csv" –NoTypeInformation 30 | 31 | **CSV Export (file added to Repo)** 32 | 33 | - Check the file 34 | 35 | - Enable filter on row 1 36 | 37 | - Filter column “B” – user by “\@” 38 | 39 | ![](media/5247f976b00076a69dcce662205faeda.png) 40 | 41 | All users are synchronized to Azure AD 42 | 43 | Regards, 44 | 45 | **Thiago 46 | Beier** [https://thiagobeier.wordpress.com](https://thiagobeier.wordpress.com/) 47 | 48 | **Copyright © 2020 Thiago Beier Blog** 49 | -------------------------------------------------------------------------------- /Other/29/external-contacts.csv: -------------------------------------------------------------------------------- 1 | ExternalAddresses 2 | thiago@gmail.com 3 | thiago1@gmail.com 4 | thiago@email.com 5 | thiago@thebeier.com 6 | thiago@collabcan.com 7 | bear@gmail.com 8 | bearwithme@gmai.com 9 | -------------------------------------------------------------------------------- /Other/29/media/2afb5613639afff857ef79b10f7dc03f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/29/media/2afb5613639afff857ef79b10f7dc03f.png -------------------------------------------------------------------------------- /Other/29/readme.md: -------------------------------------------------------------------------------- 1 | **ADDS - Creating Contacts in Active Directory from CSV** 2 | 3 | Hi there 4 | 5 | This script is will create contacts in Active Directory from CSV with prefix 6 | avoiding duplicate entries when we have info\@gmail.com and info\@yahoo.com 7 | where Name / Display name should be "info" under your Contacts OU. 8 | 9 | To avoid that we have the following script 10 | 11 | - **Prefix** : "CA-Contact-" 12 | 13 | - **Contact name / displayname** : \$contactname = "CA-Contact-" + \$name + 14 | "_" + \$domainname 15 | 16 | - OUPath: I'm using 17 | "OU=ExternalContact,OU=NotesMigration,DC=thebeier,DC=local" , replace by 18 | yours or define OUPath as variable \$OUPath = 19 | "OU=ExternalContact,OU=NotesMigration,DC=thebeier,DC=local" then you use 20 | only \$OUPath at the new-adobject cmdlet  21 | 22 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\# 23 | 24 | \# Author Thiago Beier thiago.beier\@gmail.com 25 | 26 | \# Version: 1.0 - 2020-07-16 27 | 28 | \# 29 | 30 | \# Create Contacts in ADDS from a CSV file 31 | 32 | \# All duplicates entries where Name or Dipslayname would case issues based on 33 | email-address is handled by this script 34 | 35 | \# If a user is info\@multipledomains.com , the Name , Displayname hill have the 36 | following format: 37 | 38 | \# Prefix + address + "_" (underline) + domainname without "\@" and no suffix 39 | .com .org whatever 40 | 41 | \# 42 | 43 | \# Toronto, CANADA 44 | 45 | \# Email: thiago.beier\@gmail.com 46 | 47 | \# https://www.linkedin.com/in/tbeier/ 48 | 49 | \# https://twitter.com/thiagobeier 50 | 51 | \# https://thiagobeier.wordpress.com 52 | 53 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\# 54 | 55 | clear 56 | 57 | \$dt=get-date -format yyyy-MM-dd-hhmm 58 | 59 | Start-Transcript log-\$dt.txt 60 | 61 | \$file = import-csv .\\external-contacts.csv 62 | 63 | foreach (\$line in \$file ){ 64 | 65 | \$chararray = \$line.ExternalAddresses.Split("\@") 66 | 67 | \$name = \$chararray[0] 68 | 69 | \$domainname = \$chararray[1] 70 | 71 | \$name 72 | 73 | \$line 74 | 75 | \$email = \$line 76 | 77 | \$chararray[1] 78 | 79 | \$domain = \$chararray[1].Split(".") 80 | 81 | \$domain[0] 82 | 83 | \$email = \$line.ExternalAddresses 84 | 85 | write-host "CA-Contact-" 86 | 87 | \$name 88 | 89 | \$domainname 90 | 91 | \$contactname = "CA-Contact-" + \$name + "_" + \$domainname 92 | 93 | \$contactname 94 | 95 | New-ADObject -Name "\$contactname" -DisplayName "\$contactname" -Type "contact" 96 | -Path "OU=ExternalContact,OU=NotesMigration,DC=thebeier,DC=local" 97 | -OtherAttributes \@{'mail'="\$email"} 98 | 99 | } 100 | 101 | stop-transcript 102 | 103 | CSV file 104 | 105 | ![](media/2afb5613639afff857ef79b10f7dc03f.png) 106 | 107 | All users are synchronized to Azure AD 108 | 109 | Regards, 110 | 111 | **Thiago 112 | Beier** [https://thiagobeier.wordpress.com](https://thiagobeier.wordpress.com/) 113 | 114 | **Copyright © 2020 Thiago Beier Blog** 115 | -------------------------------------------------------------------------------- /Other/3/3 - Office365 - Assign ATP licenses from a file.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/3/3 - Office365 - Assign ATP licenses from a file.docx -------------------------------------------------------------------------------- /Other/3/media/5a6495ec575c28d7e99b2a3a27e9ba04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/3/media/5a6495ec575c28d7e99b2a3a27e9ba04.png -------------------------------------------------------------------------------- /Other/3/media/6aa116cf97f5e143ce45ee8f485d9f67.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/3/media/6aa116cf97f5e143ce45ee8f485d9f67.png -------------------------------------------------------------------------------- /Other/3/o365-assign-atp-licenses.ps1: -------------------------------------------------------------------------------- 1 | ############################################################################################################################################################################################################################################### 2 | # Author Thiago Beier thiago.beier@gmail.com 3 | # Version: 1.0 - 2020-03-09 4 | # Assign ATP licenses to Users from TXT file 5 | # Toronto, CANADA 6 | # Email: thiago.beier@gmail.com 7 | # https://www.linkedin.com/in/tbeier/ 8 | # https://twitter.com/thiagobeier 9 | # thiagobeier.wordpress.com 10 | ############################################################################################################################################################################################################################################### 11 | 12 | 13 | $userlist = Get-Content .\users.txt 14 | #where users.txt has users formated as UPN or email address as thiago@thebeier.com 15 | foreach ($user in $userlist) { 16 | write-host "Assigning license to user:" $user -ForegroundColor Blue 17 | 18 | #assign license 19 | $userUPN = "$user" 20 | $planName="ATP_ENTERPRISE" 21 | $License = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense 22 | $License.SkuId = (Get-AzureADSubscribedSku | Where-Object -Property SkuPartNumber -Value $planName -EQ).SkuID 23 | $LicensesToAssign = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses 24 | $LicensesToAssign.AddLicenses = $License 25 | Set-AzureADUserLicense -ObjectId $userUPN -AssignedLicenses $LicensesToAssign 26 | 27 | } -------------------------------------------------------------------------------- /Other/3/readme.md: -------------------------------------------------------------------------------- 1 | Office365 - Assign ATP licenses from a file. 2 | 3 | Hi there 4 | 5 | If you don't have Azure AD P1 or P2 this article it's addressed to you. 6 | 7 | Here you can find what you need to export users’ current license status E1, E3 8 | and ATP. 9 | 10 | First of all, connect to your Office 365 Subscription with the following 11 | commands: 12 | 13 | Connect-ExchangeOnline 14 | Connect-AzureAD 15 | Connect-MsolService 16 | 17 | **Then you can list all available licenses available under your Office 365 18 | subscription** 19 | 20 | **Get-MsolAccountSku** 21 | 22 | Get-AzureADSubscribedSku \| Select SkuPartNumber 23 | 24 | **Retrieving user's license** 25 | 26 | Get-MsolUser -UserPrincipalName thiago\@thebeier.com \| Format-List 27 | DisplayName,Licenses 28 | 29 |   30 | 31 | **Export to CSV all Enterprise E3 licensed users** 32 | 33 | Get-MsolUser -All \| Where-Object {(\$_.licenses).AccountSkuId -match 34 | "ENTERPRISEPACK"} \| Out-file C:\\temp\\EnterpriseE3Users.csv 35 | 36 | **Export to CSV all Standard E1 licensed users** 37 | 38 | Get-MsolUser -All \| Where-Object {(\$_.licenses).AccountSkuId -match 39 | "STANDARDPACK"} \| Out-file C:\\temp\\StandardE1Users.csv 40 | 41 | **Export to CSV all Enterprise ATP licensed users** 42 | 43 | Get-MsolUser -All \| Where-Object {(\$_.licenses).AccountSkuId -match 44 | "ATP_ENTERPRISE"} \| Out-file C:\\temp\\EnterpriseATPUsers.csv 45 | 46 | **Assigning ATP licenses to E1 and E3 users.** 47 | 48 | Get-MsolUser -All \| Where-Object {(\$_.licenses).AccountSkuId -match 49 | "ENTERPRISEPACK"} \| Set-MsolUserLicense -AddLicenses "tenant:ATP_ENTERPRISE"  50 | 51 |   Get-MsolUser -All \| Where-Object {(\$_.licenses).AccountSkuId -match 52 | "STANDARDPACK"} \| Set-MsolUserLicense -AddLicenses "tenant:ATP_ENTERPRISE"  53 | 54 |   55 | 56 |   57 | 58 | ![https://gallery.technet.microsoft.com/site/view/file/226491/1/54.png](media/5a6495ec575c28d7e99b2a3a27e9ba04.png) 59 | 60 |   61 | 62 | ![https://gallery.technet.microsoft.com/site/view/file/226492/1/56.png](media/6aa116cf97f5e143ce45ee8f485d9f67.png) 63 | 64 | **PowerShell** 65 | 66 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#  67 | 68 | \# Author Thiago Beier thiago.beier\@gmail.com     69 | 70 | \# Version: 1.0 - 2020-03-09    71 | 72 | \# Assign ATP licenses to Users from TXT file  73 | 74 | \# Toronto, CANADA     75 | 76 | \# Email: thiago.beier\@gmail.com   77 | 78 | \# https://www.linkedin.com/in/tbeier/   79 | 80 | \# https://twitter.com/thiagobeier  81 | 82 | \# thiagobeier.wordpress.com  83 | 84 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#    85 | 86 |   87 | 88 |   89 | 90 | \$userlist = **Get-Content** .\\users.txt  91 | 92 | \#where users.txt has users formated as UPN or email address as thiago\@thebeier.com   93 | 94 | **foreach** (\$user **in** \$userlist) {  95 | 96 | write-host "Assigning license to user:" \$user -ForegroundColor Blue  97 | 98 |   99 | 100 | \#assign license  101 | 102 | \$userUPN = "\$user"  103 | 104 | \$planName="ATP_ENTERPRISE"  105 | 106 | \$License = **New-Object** -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense  107 | 108 | \$License.SkuId = (Get-AzureADSubscribedSku \| Where-Object -Property SkuPartNumber -Value \$planName -EQ).SkuID  109 | 110 | \$LicensesToAssign = **New-Object** -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses  111 | 112 | \$LicensesToAssign.AddLicenses = \$License  113 | 114 | Set-AzureADUserLicense -ObjectId \$userUPN -AssignedLicenses \$LicensesToAssign  115 | 116 |   117 | 118 | } 119 | 120 |  thanks, 121 | 122 | **Thiago Beier** 123 | -------------------------------------------------------------------------------- /Other/30/dgroups-members.csv: -------------------------------------------------------------------------------- 1 | GroupName,CreateinO365,GroupType,Description,Members,Example,email 2 | All Sales Toronto,Y,Multi-purpose,Toronto Sales,"CN=Thiago Beier 3 | CN=John Doe 4 | CN=Steve Jobs 5 | CN=Bill Gates",,All-Sales-Toronto 6 | All Western Canada Sales,Y,Multi-purpose,Western Canada Sales,"CN=Thiago Beier 7 | CN=Tom Cat 8 | CN=Buzz Lightyear 9 | CN=Bill Gates 10 | CN=Thiago Germano",,All-Western-Canada-Sales 11 | -------------------------------------------------------------------------------- /Other/30/media/176e27daadfcd681bdde9785a6cfed5e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/30/media/176e27daadfcd681bdde9785a6cfed5e.png -------------------------------------------------------------------------------- /Other/30/readme.md: -------------------------------------------------------------------------------- 1 | **ADDS - Creating Distribution Groups in Active Directory from CSV** 2 | 3 | Hi there 4 | 5 | This script is will create Distribution Groups in Active Directory from CSV with 6 | prefix avoiding duplicate entries. It checks if the Group already exists by 7 | Name/Displayname and CN attribute against ADDS. 8 | 9 | To avoid that we have the following script 10 | 11 | - **Prefix** : "D-CA-" 12 | 13 | - Be aware that this CSV file format it’s an export from Lotus Notes 14 | Distribution Group and we used to populate ADDS (with synced objects to 15 | Cloud:Office 365 / Exchange On-line) 16 | 17 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\# 18 | 19 | \# Author Thiago Beier thiago.beier\@gmail.com 20 | 21 | \# Version: 1.0 - 2020-07-16 22 | 23 | \# 24 | 25 | \# Create Distribution Groups in ADDS 26 | 27 | \# Create a DG if doesn't exist 28 | 29 | \# Create all DG with a prefix "D-CA-" from CSV file 30 | 31 | \# DG groups need mail and proxyaddresses attributes in AD to work after they're 32 | synced to AzureAD/Office365 tenant 33 | 34 | \# You can add, replace, remove any attribute as needed. 35 | \# \$dgemail it’s the group-name + emaildomain “\@thebeier.com” on the script 36 | 37 | \# You need to have your CSV file ready to run no blank spaces on GroupName, 38 | email address. 39 | 40 | \# 41 | 42 | \# Toronto, CANADA 43 | 44 | \# Email: thiago.beier\@gmail.com 45 | 46 | \# https://www.linkedin.com/in/tbeier/ 47 | 48 | \# https://twitter.com/thiagobeier 49 | 50 | \# https://thiagobeier.wordpress.com 51 | 52 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\# 53 | 54 | clear 55 | 56 | \$dt=get-date -format yyyy-MM-dd-hhmm 57 | 58 | Start-Transcript log-\$dt.txt 59 | 60 | \$file=IMPORT-CSV .\\dgroups-members.csv 61 | 62 | \$dgemail = \$null 63 | 64 | \$dgname = \$null 65 | 66 | \$groupobjid = \$null 67 | 68 | FOREACH (\$line in \$file) 69 | 70 | { 71 | 72 | \$dgemail = \$line.email+"\@thebeier.com" 73 | 74 | \$dgname = "D-CA-"+\$line.GroupName 75 | 76 | write-host "setting DG email address \$dgemail to" \$dgname -ForegroundColor 77 | Green 78 | 79 | \# If the group exists, inform, if it does not exist also inform. 80 | 81 | If (Get-ADGroup -Filter \* \| where {\$_.Name -like \$dgname}) 82 | 83 | { 84 | 85 | \$dgname 86 | 87 | Write-Host "\$dgname already exists in Active Directory" -ForegroundColor Green 88 | 89 | \$groupobjid = (Get-ADGroup -Filter \* \| where {\$_.Name -like 90 | "\$dgname"}).ObjectGUID 91 | 92 | \$groupobjid 93 | 94 | Set-ADGroup \$dgname -Add \@{mail = "\$dgemail"} 95 | 96 | Set-ADGroup \$dgname -Add \@{proxyAddresses = "SMTP:\$dgemail"} 97 | 98 | } 99 | 100 | Else 101 | 102 | { 103 | 104 | Write-Host "I am sorry, \$dgname does not exist." -ForegroundColor RED 105 | 106 | \$OUpath="OU=DistributionGroups,DC=thebeier,DC=local" 107 | 108 | write-host "creating group:" \$dgname -ForegroundColor Yellow 109 | 110 | New-ADGroup -Name "\$dgname" -SamAccountName "\$dgname" -GroupCategory 111 | Distribution -GroupScope Universal -Path \$OUpath -Description 112 | \$line.Description 113 | 114 | Set-ADGroup \$dgname -Add \@{mail = "\$dgemail"} 115 | 116 | Set-ADGroup \$dgname -Add \@{proxyAddresses = "SMTP:\$dgemail"} 117 | 118 | } 119 | 120 | } 121 | 122 | Stop-Transcript 123 | 124 | CSV file 125 | 126 | ![](media/176e27daadfcd681bdde9785a6cfed5e.png) 127 | 128 | All users are synchronized to Azure AD 129 | 130 | Regards, 131 | 132 | **Thiago 133 | Beier** [https://thiagobeier.wordpress.com](https://thiagobeier.wordpress.com/) 134 | 135 | **Copyright © 2020 Thiago Beier Blog** 136 | -------------------------------------------------------------------------------- /Other/4/4 - Add members to a Distribution List (DL) from a CSV file.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/4/4 - Add members to a Distribution List (DL) from a CSV file.docx -------------------------------------------------------------------------------- /Other/4/add-members-to-dl01.csv: -------------------------------------------------------------------------------- 1 | members,dlistname 2 | thiago.beier@thebeier.com,test 3 | user01@thebeier.com,test 4 | -------------------------------------------------------------------------------- /Other/4/media/0912dbc29f3155b006bbd2c653060620.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/4/media/0912dbc29f3155b006bbd2c653060620.png -------------------------------------------------------------------------------- /Other/4/media/10655b597b5bf332e2e65413aada3859.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/4/media/10655b597b5bf332e2e65413aada3859.png -------------------------------------------------------------------------------- /Other/4/media/161dad7b0db9361a0b98ab772a5df58c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/4/media/161dad7b0db9361a0b98ab772a5df58c.png -------------------------------------------------------------------------------- /Other/4/media/cb2742bf953a876c67a29f85b542ec6e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/4/media/cb2742bf953a876c67a29f85b542ec6e.png -------------------------------------------------------------------------------- /Other/4/o365-add-members-to-dl-from-csv.ps1: -------------------------------------------------------------------------------- 1 | ########################################################################################### 2 | # Author Thiago Beier thiago.beier@gmail.com 3 | # Version: 1.0 - 2020-FEB-28 4 | # Adding user to a DL (Distribution List on Office 365) from CSV file 5 | # Toronto,CANADA 6 | # Email: thiago.beier@gmail.com 7 | # https://www.linkedin.com/in/tbeier/ 8 | # https://thigobeier.wordpress.com 9 | ########################################################################################### 10 | 11 | # 12 | Import-Csv add-members-to-dl01.csv | foreach { 13 | 14 | write-host "Adding user" $_.members "to" $_.dlistname "DL" -ForegroundColor Yellow 15 | 16 | Add-DistributionGroupMember -Identity $_.dlistname -Member $_.members 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Other/4/readme.md: -------------------------------------------------------------------------------- 1 | Add members to a Distribution List (DL) from a CSV file. 2 | 3 | Hi There, 4 | 5 | This script will help you to add members to a Distribution Lists (DL) from a CSV 6 | file  7 | 8 | You just need a csv file with two columns: distribution list name (dlistname) 9 | and member (members) 10 | 11 | ![](media/cb2742bf953a876c67a29f85b542ec6e.png) 12 | 13 | https://gallery.technet.microsoft.com/site/view/file/226396/1/5.png 14 | 15 | You can also combine this script with another one to add members to DL 16 | (Distribution Lists) as well. 17 | 18 | **Testing the csv file:** 19 | 20 | *Import-Csv .\\create-dl.csv * 21 | 22 | **You should see the following** 23 | 24 | ![](media/161dad7b0db9361a0b98ab772a5df58c.png) 25 | 26 | https://gallery.technet.microsoft.com/site/view/file/226395/1/4.png 27 | 28 | **PowerShell** 29 | 30 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#      31 | 32 | \# Author Thiago Beier thiago.beier\@gmail.com      33 | 34 | \# Version: 1.0 - 2020-FEB-28     35 | 36 | \# Adding user to a DL (Distribution List on Office 365) from CSV file  37 | 38 | \# Toronto,CANADA      39 | 40 | \# Email: thiago.beier\@gmail.com    41 | 42 | \# https://www.linkedin.com/in/tbeier/    43 | 44 | \# https://thigobeier.wordpress.com  45 | 46 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#   47 | 48 | \#  49 | 50 | **Import-Csv** .\\add-members-to-dl01.csv \| **foreach** {   51 | 52 | write-host "Adding user" \$*.members "to" \$*.dlistname "DL" -ForegroundColor Yellow  53 | 54 | Add-DistributionGroupMember -Identity \$*.dlistname -Member \$*.members   55 | 56 | }  57 | -------------------------------------------------------------------------------- /Other/5/5 - Create a Distribution List (DL) from CSV on Office 365.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/5/5 - Create a Distribution List (DL) from CSV on Office 365.docx -------------------------------------------------------------------------------- /Other/5/O365-create-dl-from-csv.ps1: -------------------------------------------------------------------------------- 1 | ########################################################################################### 2 | # Author Thiago Beier thiago.beier@gmail.com 3 | # Version: 1.0 - 2020-FEB-28 4 | # Create a DL (Distribution List on Office 365) from CSV file 5 | # Toronto,CANADA 6 | # Email: thiago.beier@gmail.com 7 | # https://www.linkedin.com/in/tbeier/ 8 | # https://thigobeier.wordpress.com 9 | ########################################################################################### 10 | 11 | Import-Csv .\create-dl.csv | foreach { 12 | 13 | write-host "Creating DL:" $_.dlname -ForegroundColor Blue 14 | write-host $_.dlname -ForegroundColor green 15 | New-DistributionGroup -Name $_.dlname -Alias $_.alias -Type security 16 | 17 | write-host $_.alias -ForegroundColor Yellow 18 | Set-DistributionGroup $_.dlname -HiddenFromAddressListsEnabled $True 19 | 20 | 21 | } -------------------------------------------------------------------------------- /Other/5/create-dl.csv: -------------------------------------------------------------------------------- 1 | dlistname,dlalias,dlsmtpaddress,dldisplayname 2 | test2,test2,test2@thebeier.com,test2 3 | test3,test3,test3@thebeier.com,test3 4 | -------------------------------------------------------------------------------- /Other/5/media/99d72939e87113c8aed6959980dc11a2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/5/media/99d72939e87113c8aed6959980dc11a2.png -------------------------------------------------------------------------------- /Other/5/media/b5ede4ca5c29a1b1eba72555ac9d1af9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/5/media/b5ede4ca5c29a1b1eba72555ac9d1af9.png -------------------------------------------------------------------------------- /Other/5/media/b82cbecad38018c10d36e5e3dfb03d84.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/5/media/b82cbecad38018c10d36e5e3dfb03d84.png -------------------------------------------------------------------------------- /Other/5/readme.md: -------------------------------------------------------------------------------- 1 | Create a Distribution List (DL) from CSV on Office 365 2 | 3 | Hi There, 4 | 5 | This script will help you to create Distribution Lists (DL) from a CSV file and 6 | will hide all those DLs (Distribution Lists) from the GAL (Global Address List). 7 | 8 | We had to use a similar script to create Temporary DLs during a migration 9 | process (with similar names however with -Mig on its name). 10 | 11 | You can also combine this script with another one to add members to DL 12 | (Distribution Lists) as well. 13 | 14 | **Testing the csv file:** 15 | 16 | *Import-Csv .\\create-dl.csv {added to the repo}* 17 | 18 | **You should see the following** 19 | 20 | ![](media/b5ede4ca5c29a1b1eba72555ac9d1af9.png) 21 | 22 | After 23 | 24 | ![](media/99d72939e87113c8aed6959980dc11a2.png) 25 | 26 | https://gallery.technet.microsoft.com/site/view/file/226392/1/3.png 27 | 28 | https://gallery.technet.microsoft.com/site/view/file/226392/1/3.png 29 | 30 | https://gallery.technet.microsoft.com/site/view/file/226392/1/3.png 31 | 32 | **PowerShell** 33 | 34 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#      35 | 36 | \# Author Thiago Beier thiago.beier\@gmail.com      37 | 38 | \# Version: 2.0 - 2020-MAI-01     39 | 40 | \# Create a DL (Distribution List on Office 365) from CSV file  41 | 42 | \# Toronto,CANADA      43 | 44 | \# Email: thiago.beier\@gmail.com    45 | 46 | \# https://www.linkedin.com/in/tbeier/    47 | 48 | \# https://thigobeier.wordpress.com  49 | 50 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#   51 | 52 | Import-Csv .\\create-dl.csv \| foreach { 53 | 54 | write-host "Creating DL:" \$_.dlistname -ForegroundColor Blue 55 | 56 | write-host \$_.dlistname -ForegroundColor green 57 | 58 | New-DistributionGroup -Name \$*.dlistname -Alias \$*.dlalias -DisplayName 59 | \$*.dldisplayname -PrimarySmtpAddress \$*.dlsmtpaddress -Type security 60 | 61 | write-host \$_.dlalias -ForegroundColor Yellow 62 | 63 | Set-DistributionGroup \$_.dlistname -HiddenFromAddressListsEnabled \$True 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Other/6/6 - Export Office365 User Roles to CSV (Admin Roles).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/6/6 - Export Office365 User Roles to CSV (Admin Roles).docx -------------------------------------------------------------------------------- /Other/6/Export Office365 User Roles to CSV.ps1: -------------------------------------------------------------------------------- 1 | Connect-MsolService 2 | 3 | $AllUserRoles = @() 4 | 5 | $Users = Get-MsolUser -All 6 | foreach($user in $Users) 7 | { 8 | $UserRoles = Get-MsolUserRole -UserPrincipalName $User.UserPrincipalName 9 | foreach($role in $UserRoles) 10 | { 11 | $aRole = New-Object PSObject 12 | $UserName = $User.UserPrincipalName 13 | $RoleName = $role.Name.ToString() 14 | 15 | Add-Member -input $aRole noteproperty ‘UserName’ $UserName 16 | Add-Member -input $aRole noteproperty ‘RoleName’ $RoleName 17 | $AllUserRoles += $aRole 18 | } 19 | } 20 | 21 | $AllUserRoles | export-csv -Path C:\temp\O365UserRoles.csv -NoTypeInformation -Force -------------------------------------------------------------------------------- /Other/6/readme.md: -------------------------------------------------------------------------------- 1 | Export Office365 User Roles to CSV (Admin Roles) 2 | 3 | Hi there 4 | 5 | I was creating a runbook to export information from an Office 365 tenant for a 6 | project and in order to break it down into small parts I needed to check all 7 | users and their roles at under this Office 365 tenant. 8 | 9 | If you're looking for a script to export all Users' roles at Office 365 Portal / 10 | Tenant please use this script that was initially posted by [Jerry 11 | Yasir](https://twitter.com/jerryyasir) and I modified to fit a blog post 12 | at [https://thiagobeier.wordpress.com](https://thiagobeier.wordpress.com/)  13 | 14 |   15 | 16 | **PowerShell** 17 | 18 | \$Creds = **Get-Credential**  19 | 20 |   21 | 22 | Connect-MsolService -Credential \$Creds  23 | 24 |   25 | 26 | \$AllUserRoles = \@()  27 | 28 |   29 | 30 | \$Users = Get-MsolUser -All  31 | 32 | **foreach**(\$user **in** \$Users)  33 | 34 | {  35 | 36 |     \$UserRoles = Get-MsolUserRole -UserPrincipalName \$User.UserPrincipalName  37 | 38 |     **foreach**(\$role **in** \$UserRoles)  39 | 40 |     {  41 | 42 |         \$aRole = **New-Object** PSObject  43 | 44 |         \$UserName = \$User.UserPrincipalName  45 | 46 |         \$RoleName = \$role.Name.ToString()  47 | 48 |   49 | 50 |         **Add-Member** -input \$aRole noteproperty ‘UserName’ \$UserName  51 | 52 |         **Add-Member** -input \$aRole noteproperty ‘RoleName’ \$RoleName  53 | 54 |         \$AllUserRoles += \$aRole  55 | 56 |     }  57 | 58 | }  59 | 60 |   61 | 62 | \$AllUserRoles \| **export-csv** -Path C:\\Temp\\O365UserRoles.csv -NoTypeInformation -Force 63 | 64 |   65 | -------------------------------------------------------------------------------- /Other/7/7 - Monitor DFS backlog and Send email notification.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/7/7 - Monitor DFS backlog and Send email notification.docx -------------------------------------------------------------------------------- /Other/7/check-DFS-replicationv3.ps1: -------------------------------------------------------------------------------- 1 | #DFS Monitor and email message 2 | #run as administrator 3 | #SMTP configuration 4 | $EmailFrom = "alerts@mydomain.ca" 5 | $EmailTo = "alerts@mydomain.ca" 6 | $EmailTo1 = "eric@mydomain.ca" 7 | $EmailTo2 = "enzo@mydomain.ca" 8 | $EmailTo3 = "thiago@mydomain.ca" 9 | $EmailSubject = "DFS Monitoring Report" 10 | $emailbody = "Server reached predefined amount of files in backlog" 11 | $SMTPServer = "smtp.my-isp.ca" 12 | 13 | #Starts here 14 | 15 | $RGroups = Get-WmiObject -Namespace "root\MicrosoftDFS" -Query "SELECT * FROM DfsrReplicationGroupConfig" 16 | $ComputerName=$env:ComputerName 17 | $Succ=0 18 | $Warn=0 19 | $Err=0 20 | 21 | foreach ($Group in $RGroups) 22 | { 23 | $RGFoldersWMIQ = "SELECT * FROM DfsrReplicatedFolderConfig WHERE ReplicationGroupGUID='" + $Group.ReplicationGroupGUID + "'" 24 | $RGFolders = Get-WmiObject -Namespace "root\MicrosoftDFS" -Query $RGFoldersWMIQ 25 | $RGConnectionsWMIQ = "SELECT * FROM DfsrConnectionConfig WHERE ReplicationGroupGUID='"+ $Group.ReplicationGroupGUID + "'" 26 | $RGConnections = Get-WmiObject -Namespace "root\MicrosoftDFS" -Query $RGConnectionsWMIQ 27 | foreach ($Connection in $RGConnections) 28 | { 29 | $ConnectionName = $Connection.PartnerName#.Trim() 30 | if ($Connection.Enabled -eq $True) 31 | { 32 | #if (((New-Object System.Net.NetworkInformation.ping).send("$ConnectionName")).Status -eq "Success") 33 | #{ 34 | foreach ($Folder in $RGFolders) 35 | { 36 | $RGName = $Group.ReplicationGroupName 37 | $RFName = $Folder.ReplicatedFolderName 38 | 39 | if ($Connection.Inbound -eq $True) 40 | { 41 | $SendingMember = $ConnectionName 42 | $ReceivingMember = $ComputerName 43 | $Direction="inbound" 44 | } 45 | else 46 | { 47 | $SendingMember = $ComputerName 48 | $ReceivingMember = $ConnectionName 49 | $Direction="outbound" 50 | } 51 | 52 | $BLCommand = "dfsrdiag Backlog /RGName:'" + $RGName + "' /RFName:'" + $RFName + "' /SendingMember:" + $SendingMember + " /ReceivingMember:" + $ReceivingMember 53 | $Backlog = Invoke-Expression -Command $BLCommand 54 | 55 | $BackLogFilecount = 0 56 | foreach ($item in $Backlog) 57 | { 58 | if ($item -ilike "*Backlog File count*") 59 | { 60 | $BacklogFileCount = [int]$Item.Split(":")[1].Trim() 61 | } 62 | } 63 | 64 | if ($BacklogFileCount -eq 0) 65 | { 66 | $Color="white" 67 | $Succ=$Succ+1 68 | } 69 | elseif ($BacklogFilecount -lt 100) 70 | { 71 | $Color="yellow" 72 | $Warn=$Warn+1 73 | 74 | } 75 | else 76 | { 77 | $Color="red" 78 | $Err=$Err+1 79 | 80 | } 81 | 82 | $results = Write-Host "$BacklogFileCount files in backlog $SendingMember->$ReceivingMember for $RGName" -fore $Color 83 | $results1 = Write-Output "$BacklogFileCount files in backlog $SendingMember->$ReceivingMember for $RGName" | Out-File -FilePath C:\scripts\dfslog-$(get-date -f yyyy-MM-dd).txt -Append 84 | } # Closing iterate through all folders 85 | #} # Closing If replies to ping 86 | } # Closing If Connection enabled 87 | } # Closing iteration through all connections 88 | } # Closing iteration through all groups 89 | 90 | 91 | Send-MailMessage -Port 25 -SmtpServer $SMTPServer -From $EmailFrom -To $EmailTo,$EmailTo1,$EmailTo2,$EmailTo3 -Subject $EmailSubject -Attachments C:\scripts\dfslog-$(get-date -f yyyy-MM-dd).txt 92 | 93 | #reference https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/send-mailmessage?f=255&MSPPError=-2147217396 94 | -------------------------------------------------------------------------------- /Other/8/8 - Generate Random Password (ADDS & Azure AD Office365).docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/8/8 - Generate Random Password (ADDS & Azure AD Office365).docx -------------------------------------------------------------------------------- /Other/8/Randon-Password-Generator-v1.ps1: -------------------------------------------------------------------------------- 1 |  ################################################################################ 2 | #Author Thiago Beier thiago.beier@gmail.com 3 | #Version: 1.0 - 2019-05-30 4 | #Ask for how many password you need and generates all of them on screen 5 | #Toronto,CANADA 6 | #email: thiago.beier@gmail.com 7 | #https://www.linkedin.com/in/tbeier/ 8 | ################################################################################ 9 | 10 | $sum = read-host "How many passwords do you need?" 11 | $a = 1 12 | while($a -le $sum) 13 | { 14 | 15 | $global:DefaultPassword = (-join(65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90|%{[char]$_}|Get-Random -C 2)) + (-join(97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122|%{[char]$_}|Get-Random -C 2)) + (-join(65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90|%{[char]$_}|Get-Random -C 2)) + (-join(97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122|%{[char]$_}|Get-Random -C 2)) + (-join(64,33,35,36|%{[char]$_}|Get-Random -C 1)) + (-join(49,50,51,52,53,54,55,56,57|%{[char]$_}|Get-Random -C 3)) 16 | $showpassword = $global:DefaultPassword 17 | write-host $showpassword -ForegroundColor Green 18 | #$a 19 | $a++ 20 | } 21 | -------------------------------------------------------------------------------- /Other/8/media/9604766ecd48d2e25365819334865835.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/8/media/9604766ecd48d2e25365819334865835.png -------------------------------------------------------------------------------- /Other/8/readme.md: -------------------------------------------------------------------------------- 1 | Generate Random Password (ADDS & Azure AD / Office365) 2 | 3 | Hi again, 4 | This powershell script runs on Powershell and Powershell ISE. 5 | It generates as much as passwords you request by answering the question. 6 | Tested with Local AD (ADDS) and Azure AD & Office 365. 7 | Script asks for how many passwords do you need. 8 | Enter the amount of password to be generated. 9 | 10 | The result is shown on screen and on grid view as well. 11 | 12 | ![https://gallery.technet.microsoft.com/office/site/view/file/222150/1/galleryscript001.PNG](media/9604766ecd48d2e25365819334865835.png) 13 | 14 |   15 | 16 | **PowerShell** 17 | 18 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#    19 | 20 | \#Author Thiago Beier thiago.beier\@gmail.com    21 | 22 | \#Version: 1.0 - 2019-05-30   23 | 24 | \#Ask for how many password you need and generates all of them on screen  25 | 26 | \#Toronto,CANADA    27 | 28 | \#email: thiago.beier\@gmail.com  29 | 30 | \#https://www.linkedin.com/in/tbeier/  31 | 32 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#   33 | 34 |   35 | 36 | \$sum = **read-host** "How many passwords do you need?"  37 | 38 | \$a = 1  39 | 40 | \$result = \@()  41 | 42 |   43 | 44 | **while**(\$a -le \$sum)  45 | 46 | {  47 | 48 | \$global:DefaultPassword =  (-join(65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90\|%{[char]\$_}\|Get-Random -C 2)) + (-join(97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122\|%{[char]\$_}\|Get-Random -C 2)) + (-join(65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90\|%{[char]\$_}\|Get-Random -C 2)) + (-join(97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122\|%{[char]\$_}\|Get-Random -C 2)) + (-join(64,33,35,36\|%{[char]\$_}\|Get-Random -C 1))  + (-join(49,50,51,52,53,54,55,56,57\|%{[char]\$_}\|Get-Random -C 3))  49 | 50 | \$result +=, \$showpassword = \$global:DefaultPassword  51 | 52 | \#write-host \$showpassword -ForegroundColor Green   53 | 54 | \$a++  55 | 56 | }   57 | 58 |   59 | 60 | \$result   61 | 62 | \$result \| Out-GridView  63 | 64 |   65 | -------------------------------------------------------------------------------- /Other/9/9 - Retrieve all Office365 users and compare their displayname with ADDS.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/9/9 - Retrieve all Office365 users and compare their displayname with ADDS.docx -------------------------------------------------------------------------------- /Other/9/check-msoluser-adds.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | #Author Thiago Beier thiago.beier@gmail.com 3 | #Version: 2.0 4 | #Toronto,CANADA 5 | #Powershell Functions To Manager Office 365, Exchange Online, SharePoint and Skype for Business. 6 | #Before using this please check the PowerShell modules required 7 | ################################################################################ 8 | 9 | #Redirects all powershell output to a file 10 | Start-Transcript C:\temp\default-powershell-output.txt 11 | 12 | 13 | #Delete used TXT files before next run 14 | del C:\temp\all-adds-users-ou.txt 15 | del C:\temp\displayname-found-inadds.txt 16 | del C:\temp\displayname-notfound-inadds.txt 17 | 18 | #Retrieve all MSOL users from Office365 tenant domain and filter by DisplayName 19 | $users = Get-MSOLUser -All | select DisplayName 20 | 21 | $upn = ($users -split 'DisplayName=')[1] -split '}' 22 | $upn = ($upn -split '@')[0] 23 | 24 | foreach ($upn in $users) { 25 | $upn = ($upn -split 'DisplayName=')[1] -split '}' 26 | $upn = ($upn -split '@')[0] 27 | 28 | get-aduser -filter "Displayname -like '$upn'" -Properties * | select displayname,samaccountname,emailaddress,userprincipalname >> C:\temp\all-adds-users-ou.txt #export this output to a single text file 29 | 30 | if (Get-ADUser -filter "Displayname -like '$upn'" -Properties * -ErrorAction SilentlyContinue) { 31 | Write-host "$upn found in AD" -ForegroundColor Green 32 | $upn >> C:\temp\displayname-found-inadds.txt 33 | } 34 | else {Write-host "$upn not found in AD" -ForegroundColor red 35 | $upn >> C:\temp\displayname-notfound-inadds.txt} 36 | 37 | } 38 | 39 | 40 | #Stop powershell file redirection 41 | Stop-Transcript 42 | -------------------------------------------------------------------------------- /Other/9/media/02b09a16a56d8ffa5781b8d997e06d5b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/9/media/02b09a16a56d8ffa5781b8d997e06d5b.png -------------------------------------------------------------------------------- /Other/9/media/82de3df25159236992250466fe97845a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/9/media/82de3df25159236992250466fe97845a.png -------------------------------------------------------------------------------- /Other/9/readme.md: -------------------------------------------------------------------------------- 1 | Retrieve all Office365 users and compare their displayname with ADDS 2 | 3 | This powershell script runs better on Powershell ISE where you can make any 4 | needed changes to its outputs. 5 | 6 | You need to run from a local domain controller and also you need to connect to 7 | your office365 tenant domain before. 8 | 9 | It retrieves all MS Office 365 users from a tenant domain and check if their 10 | DisplayName exist in ADDS (Active Directory Domain Services) 11 | 12 | You can use this before enabling local ADDS synchronization with Office 365 13 | using Azure AD connect to make sure if users from Office365 tenant already exist 14 | by Displayname 15 | 16 | ![https://gallery.technet.microsoft.com/scriptcenter/site/view/file/186965/1/msol%20adds%20check1.PNG](media/02b09a16a56d8ffa5781b8d997e06d5b.png) 17 | 18 | It creates output files at c:\\temp\\ to follow up what's hapenning 19 | 20 | ![https://gallery.technet.microsoft.com/scriptcenter/site/view/file/186963/1/msol%20adds%20check.PNG](media/82de3df25159236992250466fe97845a.png) 21 | 22 | You can try my other 23 | published [script ](https://gallery.technet.microsoft.com/scriptcenter/Office365-Exchange-bb504cce?redir=0)to 24 | connect to your tenant using a function.  25 | 26 | Tips: 27 | 28 | 1. you can disable powershel transcript output to a file by changing the 29 | following 30 | 31 | \#Start-Transcript C:\\temp\\default-powershell-output.txt 32 | 33 | \#Stop-Transcript  34 | 35 |   36 | 37 | **PowerShell** 38 | 39 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#   40 | 41 | \#Author Thiago Beier thiago.beier\@gmail.com   42 | 43 | \#Version: 2.0   44 | 45 | \#Toronto,CANADA   46 | 47 | \#Powershell Functions To Manager Office 365, Exchange Online, SharePoint and Skype for Business.   48 | 49 | \#Before using this please check the PowerShell modules required   50 | 51 | \#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#   52 | 53 |   54 | 55 | \#Redirects all powershell output to a file  56 | 57 | **Start-Transcript** C:\\temp\\default-powershell-output.txt  58 | 59 |   60 | 61 |   62 | 63 | \#Delete used TXT files before next run  64 | 65 | **del** C:\\temp\\all-adds-users-ou.txt  66 | 67 | **del** C:\\temp\\displayname-found-inadds.txt  68 | 69 | **del** C:\\temp\\displayname-notfound-inadds.txt  70 | 71 |   72 | 73 | \#Retrieve all MSOL users from Office365 tenant domain and filter by DisplayName  74 | 75 | \$users = Get-MSOLUser -All \| **select** DisplayName  76 | 77 |   78 | 79 | \$upn = (\$users -split 'DisplayName=')[1] -split '}'  80 | 81 | \$upn = (\$upn -split '\@')[0]  82 | 83 |   84 | 85 | **foreach** (\$upn **in** \$users) {  86 | 87 | \$upn = (\$upn -split 'DisplayName=')[1] -split '}'  88 | 89 | \$upn = (\$upn -split '\@')[0]  90 | 91 |   92 | 93 | get-aduser -**filter** "Displayname -like '\$upn'" -Properties \* \|  **select** displayname,samaccountname,emailaddress,userprincipalname \>\> C:\\temp\\all-adds-users-ou.txt \#export this output to a single text file  94 | 95 |   96 | 97 |   **if** (Get-ADUser -**filter** "Displayname -like '\$upn'" -Properties \* -ErrorAction SilentlyContinue) {  98 | 99 |                 Write-host "\$upn found in AD" -ForegroundColor Green  100 | 101 |                 \$upn \>\> C:\\temp\\displayname-found-inadds.txt  102 | 103 |                 }          104 | 105 |         **else** {Write-host "\$upn not found in AD" -ForegroundColor red  106 | 107 |         \$upn \>\> C:\\temp\\displayname-notfound-inadds.txt}  108 | 109 |   110 | 111 |        }  112 | 113 |   114 | 115 |   116 | 117 | \#Stop powershell file redirection  118 | 119 | **Stop-Transcript**   120 | 121 |   122 | -------------------------------------------------------------------------------- /Other/README.md: -------------------------------------------------------------------------------- 1 | Scripts repository 2 | ================== 3 | 4 | New and all scripts from Technet Gallery moved to here. 5 | 6 | **What am I doing?** 7 | 8 | - I am publishing my previous Microsfot Technet Gallery scripts files on 9 | GitHub to keep it live on tech community. 10 | 11 | - This GitHub repository helps me to organize some scripts and skills that 12 | I've developped throughout my learning, labs and projects challenges. 13 | 14 | - Within this repository there will be lab guides in PDF format, PowerShell 15 | scripts, VBS scripts and customization files such as JSON files, XML files 16 | and so on and so forth. 17 | 18 | **Posts in this blog are provided “AS IS” with no warranties, and confers no 19 | rights.** 20 | 21 | 1 - [Read domain list from CSV and export email domain 22 | data.](https://github.com/thiagobeier/Script/tree/master/Other/1) 23 | 24 | 2 - [List ADDS (active directory domain services) account 25 | summary.](https://github.com/thiagobeier/Script/tree/master/Other/2) 26 | 27 | 3 - [Office365 - Assign ATP licenses from a 28 | file.](https://github.com/thiagobeier/Script/tree/master/Other/3) 29 | 30 | 4 - [Add members to a Distribution List (DL) from a CSV 31 | file.](https://github.com/thiagobeier/Script/tree/master/Other/4) 32 | 33 | 5 - [Create a Distribution List (DL) from CSV on Office 34 | 365](https://github.com/thiagobeier/Script/tree/master/Other/5) 35 | 36 | 6 - [Export Office365 User Roles to CSV (Admin 37 | Roles)](https://github.com/thiagobeier/Script/tree/master/Other/6) 38 | 39 | 7 - [Monitor DFS backlog and Send email 40 | notification.](https://github.com/thiagobeier/Script/tree/master/Other/7) 41 | 42 | 8 - [Generate Random Password (ADDS & Azure AD / 43 | Office365)](https://github.com/thiagobeier/Script/tree/master/Other/8) 44 | 45 | 9 - [Retrieve all Office365 users and compare their displayname with 46 | ADDS](https://github.com/thiagobeier/Script/tree/master/Other/9) 47 | 48 | 10 - [Monitor a folder size on real-time every 49 | hour.](https://github.com/thiagobeier/Script/tree/master/Other/10) 50 | 51 | 11 - [ADFS - Export](https://github.com/thiagobeier/Script/tree/master/Other/11) 52 | 53 | 12 - [Creates a Standard User for ADDS and Office365 54 | Management](https://github.com/thiagobeier/Script/tree/master/Other/12) 55 | 56 | 13 - [Retrieve all Office365 users and compare their UPN userprincipalname with 57 | ADDS](https://github.com/thiagobeier/Script/tree/master/Other/13) 58 | 59 | 14 - [Configure your 1st ADDS 60 | Server](https://github.com/thiagobeier/Script/tree/master/Other/14) 61 | 62 | 15 - [Office365, Exchange, SharePoint and Skype For Business Powershell Profile 63 | Script](https://github.com/thiagobeier/Script/tree/master/Other/15) 64 | 65 | 16 - [Export All Distribution Lists Information and its members to 66 | CSV](https://github.com/thiagobeier/Script/tree/master/Other/16) 67 | 68 | 17 - [Check if a DL (Distribution List) exists on Office 69 | 365](https://github.com/thiagobeier/Script/tree/master/Other/17) 70 | 71 | 18 - [Office365 & Azure Powershell Management 72 | Functions](https://github.com/thiagobeier/Script/tree/master/Other/18) 73 | 74 | 19 - [SCCM Inventory and Assessment 75 | Scripts](https://github.com/thiagobeier/Script/tree/master/Other/19) 76 | 77 | 20 - [Check ADDS attributes (email, 78 | proxysmtpaddresses)](https://github.com/thiagobeier/Script/tree/master/Other/20) 79 | 80 | 21 - 81 | [Hyperv-VMM-2012R2-UpdateKBList](https://github.com/thiagobeier/Script/tree/master/Other/21) 82 | 83 | 22 - [SCCM inventory & 84 | assessment](https://github.com/thiagobeier/Script/tree/master/Other/22) 85 | 86 | 23 - [Export SCCM apps, task sequence, collections, queries and 87 | packages.](https://github.com/thiagobeier/Script/tree/master/Other/23) 88 | 89 | 24 - [Add Multiple Users Exchange Online contacts 90 | permission](https://github.com/thiagobeier/Script/tree/master/Other/24) 91 | 92 | 25 – [Connect to office 365, Exchange Online and Teams Using 93 | PowerShell](https://github.com/thiagobeier/Script/tree/master/Other/25) 94 | 95 | 26 – [Search user and remove from a Team on Microsoft 96 | Teams](https://github.com/thiagobeier/Script/tree/master/Other/26) 97 | 98 | 27 – [ADDS, Office 365 and Teams management 99 | Groups](https://github.com/thiagobeier/Script/tree/master/Other/27) 100 | 101 | 28 – [Office 365 – Exporting Shared Mailbox Permissions to CSV (domain 102 | based)](https://github.com/thiagobeier/Script/tree/master/Other/28) 103 | 104 | 29 – [ADDS - Creating Contacts in Active Directory from 105 | CSV](https://github.com/thiagobeier/Script/tree/master/Other/29) 106 | 107 | 30 – [ADDS - Creating Distribution Groups in Active Directory from 108 | CSV](https://github.com/thiagobeier/Script/tree/master/Other/30) 109 | 110 | **Feedback** 111 | 112 | Please use the Issues tab to provide feedback. I will periodically create new 113 | files to incorporate the changes and work if you as you'd like to. 114 | 115 | I hope using this GitHub repository brings a sense of collaboration to the labs 116 | and improves the overall quality of your skills development experience. 117 | 118 | Regards, 119 | 120 | **Thiago Beier** https://thiagobeier.wordpress.com 121 | 122 | **Copyright © 2020 Thiago Beier Blog** 123 | 124 |

125 | 126 | GitHub badge 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 |

135 | -------------------------------------------------------------------------------- /Other/TPG/DEV_PPKG_CREG.ppkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/TPG/DEV_PPKG_CREG.ppkg -------------------------------------------------------------------------------- /Other/TPG/DEV_PPKG_Default.ppkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/TPG/DEV_PPKG_Default.ppkg -------------------------------------------------------------------------------- /Other/TPG/Project_2.ppkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/TPG/Project_2.ppkg -------------------------------------------------------------------------------- /Other/TPG/TPG-importHash.ppkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thiagobeier/Script/4f2f8394cf2b3f3fd2d7df53ab37878a7e24543b/Other/TPG/TPG-importHash.ppkg --------------------------------------------------------------------------------