PowerShell: Disable MFA For All O365 Users

KB ID 0001655

Problem

If you have something boring/repetitive to do then Powershell is your friend! I needed to do this for a client that’s replacing their Office365/Azure AD MFA (Multi Factor Authentication) with Duo.

Solution

Connect to your Microsoft Services Online, i.e. Office365/Azure, using your administrative credentials with the following command;

[box]

Connect-MsolService

[/box]

Then (Note: I’ve got more than 1000 users so I need to add the MaxResults switch).

[box]

Get-MsolUser -MaxResults 2000 | Set-MsolUser -StrongAuthenticationRequirements @()

[/box]

Office 365: Disable MFA For One User

Similar to above;

[box]

Get-MsolUser -UserPrincipalName {user-name} | Set-MsolUser -StrongAuthenticationRequirements @()

[/box]

Related Articles, References, Credits, or External Links

NA

PowerShell: Add All Members of an OU to a Security Group

KB ID 0001589

Problem

I’ve written in the past about ‘Bulk Adding Users from CSV files, into Groups‘. But what if you want to add ALL users in a particular OU into a security group?

Solution

The syntax is;

[box]

Get-ADUser -SearchBase ‘OU=Source-OU,OU=PNL,DC=pnl,DC=com’ -Filter * | ForEach-Object {Add-ADGroupMember -Identity ‘SG-Test-Group’ -Members $_ }

[/box]

Here I’ve got 20 users that need adding to a group, in this example the group’s in the same OU, but it does not have to be;

You will need to close and reopen the group properties for it to refresh its membership.

Related Articles, References, Credits, or External Links

NA

Windows ‘Where’s the Startup Folder?’

Windows 8 Shell Commands for ‘Special Folders’

KB ID 0000709 

Problem

With Windows 7 (and earlier versions) you could simply find the startup folder from the start menu, now you don’t have one, (and its NOT on the Windows Key+X replacement menu either).

Solution

The simple answer to the question is,

Your user Startup folder is located at;

[box]%appdata%MicrosoftWindowsStart MenuProgramsStartup[/box]

The All users Startup folder is located at;

[box]%ProgramData%MicrosoftWindowsStart MenuProgramsStartUp[/box]

To access the Startup folder quickly

To open Your users Startup folder > Windows Key+R > shell:startup {Enter}.

To open the All users Startup folder > Windows Key+R > shell:common startup {Enter}.

This works because the startup folder is listed as a ‘Special Folder’. There are a LOT of special folders you can open in that way, They are all listed in the following registry key:

[box]HKLM > Software > Microsoft > Windows > CurrentVersion > Explorer > FolderDescriptions[/box]

Windows 8 Special Folders for Shell Commands.

Here’s a few more if you want to play.

Windows 8 Specific Special Folders.

AccountPictures
Application Shortcuts
AppsFolder
HomeGroupCurrentUserFolder
HomeGroupFolder
ProgramFilesCommonX64
ProgramFilesX64
PublicAccountPictures
PublicLibraries
Roamed Tile Images
Roaming Tiles
Screenshots

Special Folders that existed Pre Windows 8

AddNewProgramsFolder Administrative Tools AppData AppUpdatesFolder Cache CD Burning ChangeRemoveProgramsFolder Common Administrative Tools Common AppData Common Desktop Common Documents Common Programs Common Start Menu Common Startup Common Templates CommonDownloads CommonMusic CommonPictures CommonRingtones CommonVideo ConflictFolder ConnectionsFolder Contacts ControlPanelFolder Cookies CredentialManager CryptoKeys CSCFolder Desktop Device Metadata Store DocumentsLibrary Downloads DpapiKeys Favorites Fonts Games GameTasks History ImplicitAppShortcuts InternetFolder Libraries Links Local AppData LocalAppDataLow LocalizedResourcesDir MAPIFolder MusicLibrary My Music My Pictures My Video MyComputerFolder NetHood NetworkPlacesFolder OEM Links Original Images Personal PhotoAlbums PicturesLibrary Playlists PrintersFolder PrintHood Profile ProgramFiles ProgramFilesCommon ProgramFilesCommonX86 ProgramFilesX86 Programs Public PublicGameTasks Quick Launch Recent RecordedTVLibrary RecycleBinFolder ResourceDir Ringtones SavedGames Searches SearchHomeFolder SendTo Start Menu Startup SyncCenterFolder SyncResultsFolder SyncSetupFolder System SystemCertificates SystemX86 Templates User Pinned UserProfiles UserProgramFiles UserProgramFilesCommon UsersFilesFolder UsersLibrariesFolder VideosLibrary Windows

Related Articles, References, Credits, or External Links

NA

Exchange – Display/Export Users Mailbox Folder Sizes

KB ID 0000860 

Problem

A client asked this morning if there was a way he could see each users mailbox size, this is pretty simple to do see here. But he wanted to see each individual folder, and see a breakdown on the sizes of these folders.

Solution

Display Folder Sizes For an Individual User

From the Exchange Management Shell, execute the following command;

[box] Get-MailboxFolderStatistics pete | Select Identity,Name,FolderSize,ItemsinFolder | Export-Csv C:Petes_Folder_Size.csv[/box]

This will export to a CSV file in the location specified above.

Display Folder Sizes For All Users

From the Exchange Management Shell, execute the following command;

[box]Get-MailboxDatabase | Get-Mailbox -ResultSize Unlimited | Get-MailboxFolderStatistics | Select Identity,Name,FolderSize,ItemsinFolder | Export-Csv C:Users_Folder_Size.csv[/box]

Note: If you have less than 1000 mailboxes, you don’t need to add the ‘-ResultSize Unlimited’ switch

This will export to a CSV file in the location specified above.

Related Articles, References, Credits, or External Links

NA