PowerShell Command-Line
Active Directory
Export All AD Users to CSV:
Get-ADUser -Filter * -Properties * | Select-Object name, mail, LastLogonDate, WhenCreated | export-csv -path c:\userexport.csv
Get AD User Properties:
Get-ADUser -Identity <ACCOUNT> -Properties *
Get all GPOs and their creation time:
DSQuery * -Filter “(ObjectCategory=GroupPolicyContainer)” –attr DisplayName WhenCreated
Hyper-V
Get Snapshot on VM:
Get-VMSnapshot -VMName <NAME>
Get-VMSnapshot -ComputerName <NAME-OF-COMPUTER> -VMName <VM-NAME>
Delete VM Snapshot:
Get-VMSnapshot -VMName <VM-NAME> | Remove-VMSnapshot
Office 365
Connect to Tenant:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
Remove-PSSession $Session
Get Calendar Permission:
Get-MailboxFolderPermission -Identity <USER>:\calendar
Mehdi
0
Tags :
