Distribution list creation
new-distributiongroup -name "##PFRL-SZ-Zone" -Displayname "##PFRL-SPO-Zone"
-Primarysmtpaddress sz.zonal@pantaloons.adityabirla.com
add members to the group
import-csv 'C:\Users\mail.admin\Desktop\rd.csv' | %{add-distributiongroupmember
-identity "#MFL-" -member $_.email -BypassSecurityGroupManagerCheck}
Group creation for bulk
import-csv 'C:\Users\mail.admin\Desktop\myfit.csv' | %{ new-distributiongroup -name
$_.group -Displayname $_.group -Primarysmtpaddress $_.email
Getting Proxy address from AD
Get-ADUser -Filter * -SearchBase 'dc=abnl,dc=com' -Properties * | select
displayname,@{n="ProxyAddresses";e={$_.ProxyAddresses}}| export-csv
proxyaddress.csv -NoTypeInformation
Mailbox statistics
Get-MailboxStatistics manoj.pandey | fl
To change UserPrincipal Name
Set-MsolUserPrincipalName -UserPrincipalName magesh.bisht@madura.adityabirla.com
-NewUserPrincipalName maghesh.bisht@madura.adityabirla.com
to get deleted mailbox details
get-msoluser -returndeleteduser
To get the Last log on information of mailboxes
--->export the licensed users and den run this command
import-csv 'C:\Users\mail.admin\Desktop\Export.csv'|%{Get-mailboxstatistics
$_.email|select displayname,EmailAddress,lastlogontime,lastlogofftime} | export-csv
export2.csv
To get Group ID Members
Get-DistributionGroupMember "#MFL-Corporate" -ResultSize unlimited | select
Displayname,PrimarySmtpAddress | Export-csv C:\Users\mail.admin\Desktop\corp.csv
Enabling License and creating ids
Import-Csv "D:\Retail\Retail_users list_21-09-2015.csv" | %{New-MsolUser
-UserPrincipalName $_.UPN -DisplayName $_.DisplayName -FirstName $_.FirstName
-LastName $_.LastName -Password $_.Password -LicenseAssignment
"abgapparelretail:EXCHANGESTANDARD" -UsageLocation $_.UsageLocation }
Enabling Lync license
Import-Csv "C:\Users\mail.admin\Desktop\PFRLLYNCUPN.csv" | %{Set-MsolUserLicense
-UserPrincipalName $_.UPN -AddLicenses $"abgapparelretail:MCOSTANDARD"}
Changing password in bulk using CSV
Import-CSV 'C:\Users\mail.admin\Desktop\Passwordchange.csv' |%{Set-MsolUserPassword
-userPrincipalName $_.UserPrincipalName �NewPassword Pass@123 -ForceChangePassword
$False}
To Get the License details of O365
Get-MsolAccountSKU
to Get UPN address
import-csv 'C:\Users\mail.admin\Desktop\PFRLLync.csv'| %{get-mailbox $_.Email} |
select userprincipalname | export-csv pfrllync.csv
To remove License
import-csv 'C:\Users\mail.admin\Desktop\Retail_deactvate.csv'| %{set-
MsolUserLicense -UserPrincipalName $_.UPN -RemoveLicenses
$abgapparelretail:EXCHANGESTANDARD}
import-csv 'C:\Users\mail.admin\Desktop\PFRLLYNCUPN.csv'| %{set-MsolUserLicense
-UserPrincipalName $_.UPN -RemoveLicenses$abgapparelretail:MCOIMP}
To get the mail Id blocked.
Get-mailboxjunkemailconfiguration "mail Id"
To delete Mail Id from O365
import-csv 'C:\Users\mail.admin\Desktop\test.csv'| %{Remove-Msoluser
-UserPrincipalName $_.PrimaryEmailAddress}
Get-MsolUser -All |Where {$_.IsLicensed -eq $true } |Select
DisplayName,@{n="Licenses
Type";e={$_.Licenses.AccountSKUid}},UserPrincipalName,@{n="ProxyAddresses";e={$_.Pr
oxyAddresses}}| Export-csv -Path C:\Users\mail.admin\Desktop\licen.csv -notype
Set user's passwords to never expiry.
For Multiple users
Get-MSOLUser | Set-MSOLUser �PasswordNeverExpires $true
For Single user
Set-MsolUser -UserPrincipalName guoxu@jiuzhoudengshi.xyz -PasswordNeverExpires
$true
To See password expiry for users
Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires
To get mailbox restoration status
Get-MailboxRestoreRequest
To get mailbox exchange ID
get-mailbox hcp171.jharsuguda@abfrl.adityabirla.com | ft ExchangeGUID
To get deleted mailbox exchange ID
get-mailbox -SoftDeletedMailbox hcp148.silchar | ft ExchangeGUID
To move mails from deleted mailbox to the new mailbox
New-MailboxRestoreRequest -SourceMailbox "1017dd51-6ca0-4876-a474-1e3f7f7bb8c4"
-TargetMailbox "5e0d413e-71bb-409c-a971-9333f46b26a2" -AllowlegacyDNmismatch
New-MailboxExportRequest -Mailbox sr100812@madura.adityabirla.com -Mailbox
To get mailboxs
Get-Mailbox -ResultSize Unlimited -Filter '(RecipientTypeDetails -eq
"UserMailbox")' | Select RecipientTypeDetails,Name,Alias,UserPrincipalname |
Export-csv�d:\output\Usermailbox21.csv�(file:///d:/output/Usermailbox21.csv)
To get mailboxs ussage details.
Get-User -ResultSize Unlimited | Group RecipientTypeDetails | Export-
csv�d:\output\cx-grouptype33.csv�(file:///d:/output/cx-grouptype33.csv)�
To get mailbox created
get-mailbox -id kumar.chandan@pantaloons.adityabirla.com | select whenCreated
Getting users blocked ids
Get-MailboxJunkEmailConfiguration
shivaraj.subramaniam@madura.adityabirla.com@madura.adityabirla.com |select -expand
blockedsendersanddomains
Removing blocked domains
Set-MailboxJunkEmailConfiguration -Identity
shivaraj.subramaniam@madura.adityabirla.com -BlockedSendersAndDomains
@{remove="biadmin@madura.adityabirla.com"}
***********************************************************************************
*******************************************************************
Self Tested Command List below:
To get complete mailbox details
Get-Mailbox -ResultSize unlimited | select UserPrincipalName,PrimarySmtpAddress |
export-csv C:\Users\abhijeet.kumar-v\Desktop\963258.csv -notype
Get-Mailbox -ResultSize unlimited | select
CustomAttribute5,UserPrincipalName,PrimarySmtpAddress | export-csv
C:\Users\abhijeet.kumar-v\Desktop\96325fsf8.csv -notype
Get-DistributionGroupMember "#MFL-MYFIT-FOS" -ResultSize unlimited | select
Displayname,PrimarySmtpAddress | export-csv C:\Users\abhijeet.kumar-v\Desktop\mfl-
myfit.csv -notype
Get-Mailbox -Filter '(RecipientTypeDetails -eq "UserMailbox")' | Select
RecipientTypeDetails,Name,Alias| export-csv C:\Users\abhijeet.kumar-
v\Desktop\22125.csv -notype
import-csv 'C:\Users\abhijeet.kumar-v\Desktop\retaildec90days.csv' | %{add-
distributiongroupmember -identity "#MFL-90days-activity" -member $_.email
-BypassSecurityGroupManagerCheck}
**************************************
From:
Bhargav G [IBM]
Import-csv 'C:\Users\abhijeet.kumar-v\Desktop\member1.csv' | select-object UPN ,
@{name = 'LastLogonTime'; Expression={(Get-MailboxStatistics $_.UPN) | select
LastLogonTime} } | Export-Csv 'C:\Users\abhijeet.kumar-v\Desktop\mflowa90days.csv'