Powershell Scripts & Snippets
Manipulate and Report from AD on-Premises.
- Get_UsersByOU - Search all users within a specific location and get properties, export to csv.
- Set_ADUserPropertiesFromCSV - Import CSV file, get current properties, set to new property - compare changes.
- Connect_Azure - Does what it says on the box.
- Get_LicensedUsers - Lists all licensed users.
- RemoveUser - Prompts for email before executing Remove-MsolUser command (inc. recycle bin).
Who even has on-Premises Exchange these days?
- ExportPST - Export PSTs from mailboxes, check progress for big nasty ones.
Mess with your cloud tenants!
- Connect_O365 - Prompt for creds, then connect to tenant.
- Connect_O365_SfB - As above, but for Lync/SfB tenant.
- Convert_MailboxToShared - Prompts for account, then converts to shared mailbox.
- Enable_LegalHold - Enables Litigation Hold on all Mailboxes.
- Get_DistributionGroupMembers - Loops through ALL DGs and lists every member of each DG.
- Get_MailboxLimits - Retrieves full stats on a mailbox.
- Get_MailboxStats - Retrieves full stats on many (ALL) mailboxes.
- Set_MailboxDelegations - Send As, Full Access and Send on Behalf commands.
- Wizard_AutoExpandingArchive - Wizard to audit or set AutoExpandingArchive specific mailbox or tenant.
Day-to-day Windows Commands / Tools.
- Enable_Scripts - Enables PowerShell scripts to run on the local machine.
- Get_FileDownloadAndExecute - Download a file from a URL, then run it (silently).
- Get_Printers - List the printers available on the local machine.
- Get_RegistryTestAndSet_Registry - Checks Registry Path exists, creates if it doesnt, and creates a new key.
- Get_VPNVerifyConnected - Confirms if you're connected to a VPN. It doesn't care which, just that one is live.
Things to consider for first-logon / automated builds.
- AIO_DeBloater - Master "RunOnce" script, starts by enabling PowerShell.
- Set_AppSuggestions - Toggle for "Suggested" Apps.
- Set_BloatApps - Toggles for bloat apps like MineCraft UWP etc auto-installing.
- Set_FastStartup - Enable / Disable Fast Startup (stupid hibernate setting).
- Set_Hibernation - Enable / Disable Hibernation.
- Set_MSFTEdge - Stop Edge from taking over.
- Set_NumlockOnStartup - Toggle Numlock on Startup.
- Set_PhotoViewer - Associate Photo Viewer.
- Set_PinnedIconsTiles - Unpin Start Menu Tiles and Taskbar Icons.
- Set_RunOnce - Open the default user hive, edit runonce and save & close it.
- Set_SearchForAppInStore - Toggle ability to "search for app in store" at open-with prompt.
- Set_ServerManagerOnLogon - Choose whether this pops up or not on servers.
- Set_TaskBarPeopleButton - Toggle People Button on the Taskbar.
- Set_TaskBarSearchIconBox - Choose how cortana/search bar display on the Taskbar.
- Set_Telemetry - Enable / Disable Win10 Telemetry.
- Set_TrayIcons - Show / Hide all Tray Icons.
Preference Toggles and default app/file associations.
- Set_AutoRunAutoPlay - Toggles for Auto Run and AutoPlay, default is both off.
- Set_ControlPanelView - Settings for Control Panel style, large, small icons or category view.
- Set_ExplorerThumnails - Sets Thumbnail generation / caching.
- Set_ExtTypeHiddenFiles - Choose to show/hide extentions & hidden files.
- Set_FileExplorerDefaultWindow - Choose if new explorer windows open This PC or Quick Access.
- Set_KeyboardLanguage - Add / Remove Keyboard Languages (try ENG INTL).
- Set_LibraryMusicPicVid3D - Show / Hide Music, Pictures, Videos, 3D Objects Libraries in Explorer.
- Set_NetworkProfilesPubPriv - Set Networks to Public or Private.
- Set_ShortcutCreationStyle - Toggles the appending of "- shortcut" and little arrow icon overlay to shortcuts.
- Set_StartMenuPins - Pin items to start menu based on name.
- Set_StartMenuWebSearch - Toggle if Start Menu searches include web results.
- Set_TaskBarIconSizeStyle - Choose Large, Small, combined task bar icon styles.
- Set_TaskBarPins - Currently disabled/obfuscated by MSFT.
- Set_TaskBarTaskViewButton - Toggle the Task View button on or off.
- Set_WifiSense - Turn Wifi Sense on or off.
- Set_Windows7PhotoViewer - Properly unlocks this in open-with, doesn't set as default (yet).