Powershell

[PS] [EX2010] Recoverable Folder Size Report

Recoverable Folder Size Report v1 Crawls all mailboxes and pulls the recoverableitemsquota size Displays top 10 in HTML report Full CSV report is generated E-mails report with full report

 

[EX2010][PS] Recover mail items from Exchange

How do I recover an item after its been deleted? So long as the recoverable items purge duration has not exceeded, you can run the below command to pull e-mails. For more specific searchquery, reference Advanced Query Syntax (AQS).

Email  Meetings  Tasks  Notes  Docs  Journals  Contacts  IM   

[PS] Enable TLS 1.2 as default in Powershell

Check Supported protocol [Net.ServicePointManager]::SecurityProtocol [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12   Change Net Frame to use TLS 1.2 Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319’ -Name ‘SchUseStrongCrypto’ -Value ‘1’ -Type DWord Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319’ -Name ‘SchUseStrongCrypto’ -Value ‘1’ -Type DWord  

[EX2010] Litigation Hold (Legal Hold)

Litigation Hold (Legal Hold) Used to preserve mailbox and electronically stored information in anticipation of legal proceedings, investigations, and unspecified reasons. Organizations may be required to inform when a user is placed on litigation hold. Specifications: Requires Discovery Management or Legal Hold Mgmt (RBAC) to place a mailbox in legal hold Option to enable or   →

[PS] Write powershell errors to a text file

Method 1: Try, Catch, Finally Try: Try to execute a command Catch: Catches any errors, triggers only for Terminating Errors, so you may need to set a ErrorAction -Stop (EA) for errors that are not terminating. Finally: Runs regardless if a error occurs.

Method 2: Output error directly to error log 

Method 3:   →

[EXCH] The Cluster service cannot be started. Event ID 1090

Check the Status of Mailbox Servers by running Get-DatabaseAvaliabilityGroup | FL Inspect servers in stopped and started state If a mailbox is in a stopped state, you can attempt to stop the individual server by running: Stop-DatabaseAvaliabilityGroup -identity <cluster> -mailboxserver <mailbox server> Check the status of the  Fail-over Cluster Service Manager Launch Fail-over Cluster   →

[O365][PS] Exchange Online Powershell Module and connecting to Exchange Online

Example 1:

Example 2:

 Troubleshooting Errors: New-ExoPSSession : user_realm_discovery_failed: User realm discovery failed

Check proxy settings in IE New-ExoPSSession: The SSL certificate could not be checked for revocation.

Set winhttpbyusingsetproxycommand: Show: netsh winhttp show proxy Set Proxy: netsh winhttp set proxy <proxy url or ip>:<port> Reset Proxy: netsh winhttp reset proxy   →

[PS] Creating a Key File and Password File

Creating a Key File and Password File With PowerShell, we can generate a 256-bit AES encryption key: Creating the AES.key

Creating the password file

Using the key and password file

       

[PS] Working with Variables

Variables uses the $ (Dollar Sign). Takes text, integers, and store output from cmdlets. Examples: Storing strings $Var=”Hello” Storing integars $Var=”5″ $Var=”1.0″ Storing output from cmdlets $Var=Get-Services bits (Grabs a Service Controller Object) – $Var.status would output status – $Var.stop() would stop bits services – $Var.refresh() refreshes the storage Storing using user input $Var=Read-host “Enter   →

[PS] List of Aliases Used in PowerShell

HTML TABLE HelpUri ResolvedCommandName DisplayName ReferencedCommand ResolvedCommand Definition Options Description OutputType Name CommandType Visibility ModuleName Module RemotingCapability Parameters ParameterSets http://go.microsoft.com/fwlink/?LinkID=113300 ForEach-Object % -> ForEach-Object ForEach-Object ForEach-Object ForEach-Object ReadOnly, AllScope System.Collections.ObjectModel.ReadOnlyCollection1[System.Management.Automation.PSTypeName] % Alias Public None System.Collections.Generic.Dictionary2[System.String,System.Management.Automation.ParameterMetadata] http://go.microsoft.com/fwlink/?LinkID=113423 Where-Object ? -> Where-Object Where-Object Where-Object Where-Object ReadOnly, AllScope System.Collections.ObjectModel.ReadOnlyCollection1[System.Management.Automation.PSTypeName] ? Alias Public None System.Collections.Generic.Dictionary2[System.String,System.Management.Automation.ParameterMetadata]