Tuesday, May 21, 2019

Office 365 Password never expire change for Single user


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#Get the office 365 credential
$AzureAdCred = Get-Credential
Connect-MsolService -Credential $AzureAdCred
Connect-AzureAD -Credential $AzureAdCred

# Below powershell command is used to set the PasswordNeverExpires to True.
Set-MsolUser -UserPrincipalName sanjiv@softpoc.com -PasswordNeverExpires $true

# Below powershell command is used to Get the PasswordNeverExpires status for individual user.
Get-AzureADUser -ObjectId sanjiv@softpoc.com | Select-Object UserprincipalName,@{

    N="PasswordNeverExpires";E={$_.PasswordPolicies -contains "DisablePasswordExpiration"}

 }

Thursday, May 9, 2019

Get SharePoint Online all site collection details using power shell

   # If you find error related with  Connect-SPOService . You need to download and install the SharePoint Online Management Shell : DOWNLOAD

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
$SPOModulePath = 'C:\Program Files\SharePoint Online Management Shell\'
$adminUPN = 'Admin.User@softPOC.com'
$orgName = 'SOFTPOC'

$userCredential = Get-Credential -UserName $adminUPN
$Env:PSModulePath = '{0};{1}' -f $Env:PSModulePath, $SPOModulePath
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
$uri = "https://$orgName-admin.sharepoint.com"
Connect-SPOService -Url $uri -Credential $userCredential
$sites = Get-SPOSite -Limit All
$sites | select url,owner

# Create a folder with name Temp in C:\ drive
$CSVpath = "C:\Temp\SharePoint-SiteCollection-Report-New.csv"
$sites | Export-CSV -Path $CSVpath -Append -NoTypeInformation

HTML

Script:

JS