Month: May 2019

  • Example 1: Import-Module (Get-ChildItem -Path $($env:LOCALAPPDATA+”\Apps\2.0\”) -Filter ‘*ExoPowershellModule.dll’ -Recurse | Foreach{(Get-ChildItem -Path $_.Directory -Filter CreateExoPSSession.ps1)} | Sort-Object LastWriteTime | Select-Object -Last 1).FullName $User = “epic@onmicrosoft.com” $PasswordFile = “c:\o365\Password.txt” $KeyFile = “c:\o365\AES.key” $key = Get-Content $KeyFile $MyCredential = New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $User, (Get-Content $PasswordFile | ConvertTo-SecureString -Key $key) $proxysettings…

    + , ,
  • Creating a Key File and Password File With PowerShell, we can generate a 256-bit AES encryption key: Creating the AES.key $KeyFile = “C:\o365\AES.key” $Key = New-Object Byte[] 32 # You can use 16, 24, or 32 for AES [Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($Key) $Key | out-file $KeyFile Creating the password file $PasswordFile = “Password.txt”…

    +
  • 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…

    +
  • 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.ReadOnlyCollection`1[System.Management.Automation.PSTypeName] % Alias Public None System.Collections.Generic.Dictionary`2[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.ReadOnlyCollection`1[System.Management.Automation.PSTypeName] ? Alias Public None…

    +
  • Display the list of mailbox actions that are currently being for a mailbox for each logon type: Get-Mailbox <username> | Select-Object -ExpandProperty AuditOwner Get-Mailbox <username> | Select-Object -ExpandProperty AuditAdmin Get-Mailbox <username> | Select-Object -ExpandProperty AuditDelegate Enable rest of the auditing actions get-mailbox elau | set-mailbox -auditowner @{Add=”create”,”softdelete”,”harddelete”,”update”,”move”,”movetodeleteditems”,”mailboxlogin”,”updatefolderpermissions”} get-mailbox elau |…

    +