This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# all mailboxes in a site Ex10 EMS query #> | |
# one-line follows | |
get-exchangeserver | | |
where { $_.IsMailboxServer -eq $true -AND $_.Site -like '*SiteA*' -AND $_.admindisplayversion.major -eq 14 } | | |
get-mailboxdatabase | | |
where {$_.ReplicationType -eq "Remote"} | | |
get-mailbox -resultsize unlimited | | |
select samaccountname,DisplayName,Alias, Office,WindowsEmailAddress, @{Name='Addresses';Expression={[string]::join(";", ($_.EmailAddresses))}}, Database,ServerName,IsResource,IsLinked,IsShared, UseDatabaseQuotaDefaults,IssueWarningQuota, ProhibitSendQuota,ProhibitSendReceiveQuota, ArchiveDatabase,ArchiveGuid,ArchiveName, ArchiveQuota,ArchiveWarningQuota,WhenMailboxCreated, HasPicture,HasSpokenName,OrganizationalUnit, LegacyExchangeDN,PrimarySmtpAddress,RecipientType, RecipientTypeDetails,RequireSenderAuthenticationEnabled, SimpleDisplayName,ExchangeVersion,Name,DistinguishedName, Guid,ObjectCategory,WhenChanged,WhenCreated | | |
export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# test mapi latency on a list of mailboxes#> | |
# one line follows... | |
get-content .\list.txt | | |
get-mailbox | | |
Test-MAPIConnectivity | | |
select Server, Database,Mailbox, Result,@{label="Latency(ms)";expression={($_.Latency.Milliseconds)}} | | |
ft -auto | out-default ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# TRIMMED GIST see full post at github for details #> | |
#*------v Function CheckSmartArray v------ | |
function CheckSmartArray { | |
Write-Host -foregroundcolor green "`nChecking SmartArray on system $($env:COMPUTERNAME), controller slot $($targControllerSlot)..." ; | |
C:\Windows\System32\cmd.exe /c "C:\Program Files (x86)\Compaq\Hpacucli\Bin\hpacucli.exe" controller slot=$($targControllerSlot) physicaldrive all show | |
} ; #*------^ END Function CheckSmartArray ^------ | |
<# TRIMMED #> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# This is a code block that uses a splat to run an updating cmdlet | |
It uses a splat for the params, echo's the pre & post values, and the splat for the changes, | |
and supports whatif etc. | |
USAGE: | |
1. Update the TARGCMDLET with the real cmdlet ("set-exoOwaMailboxPolicy") | |
2. Update the $splat with target params for updating | |
3. Update the $props with an array ("PROP1","PROP2")of the prop names to be reported back (freq they match the $splat values) | |
4. Replace the GET-CMDLET with the real cmdlet's get-XXX variant. | |
5. Use $whatif=$true/$false to test and live-fire. | |
#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$whatif=$true ; | |
$spltMbxGrant=@{ | |
Identity="TARGETMAILBOX" ; | |
User="GRANTEE" ; | |
AccessRights="FullAccess"; | |
whatif=$($whatif); | |
}; | |
write-verbose "Running whatif test of add-MailboxPermission with following parameters" ; | |
$spltMbxGrant.whatif=$true ; | |
$spltMbxGrant | out-string ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# -- TRIMMED GIST -- SEE FULL SCRIPT AT GITHUB FOR DETAILS | |
https://github.com/tostka/PowerShell/blob/master/ExchangeScripts/move-MailboxesMostRecent.ps1 | |
-#> | |
$domaincontroller="DOMAINCONTROLLER" ; | |
write-verbose -verbose:$true "$((get-date).ToString('HH:mm:ss')):Using BatchName:$($BatchName)" ; | |
write-verbose -verbose:$true "$((get-date).ToString('HH:mm:ss')):Moving most recent $($Number) mailboxes" ; | |
if($db=get-mailboxdatabase $database -domaincontroller $domaincontroller ){ | |
write-verbose -verbose:$true "$((get-date).ToString('HH:mm:ss')):Moving most recent $($Number) mailboxes" ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tlogs="System","Application","Lync Server" ;$tSrvr=$env:COMPUTERNAME ;$fltEvt=@{ logname=$null ; StartTime=(get-date "4/19/2018 1:00:00 PM") ; EndTime=(get-date "4/19/2018 3:40:00 PM") ; } ;$evts=$null ;$of=".\logs\ComboEvts-$($tlogs -join ',')-$($tSrvr)-SPAN-$(get-date $fltEvt.StartTime -format 'yyyyMMdd-HHmmtt')-TO-$(get-date $fltEvt.EndTime -format 'yyyyMMdd-HHmmtt').csv" ;foreach($tlog in $tlogs){ $fltEvt.logname=$tlog ; $lEvts = Get-WinEvent -computername $tSrvr -FilterHashtable $fltEvt | select TimeCreated,@{Name='Logname';Expression={$tlog}},Level,LevelDisplayName ,ProviderName,Id,Message ; $evts+=$lEvts ; "Log:$($fltEvt.logname):Evts:$(($lEvts|measure).count)/$(($evts|measure).count) Ttl" ;} ;$evts | sort TimeCreated | export-csv -path $of -notype ;$of=resolve-path $of ;"Evts exported to`n$($of)" ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ======== V O365 EXO ETC FUNCS() V === | |
# stuff your Office 365 admin account credentials into variables for unprompted reuse | |
<# the following are Admin (UID) and non-admin (LUA) credential objects for different tenants and logons | |
I keep their definitions in another profile-level pre-loaded module. | |
$o365AdmUid = "logon@domain.com" ; # Tenant 1 primary admin logon UPN | |
$o365LabAdmUid = "logon@domainlab.com" ; # # Tenant 2 primary admin logon UPN | |
$o365COAdmUid="logon@tenant1.onmicrosoft.com" ; # Tenant 1 optional cloud-only admin acct (for backup in case of loss of federated access) | |
$o365LabCOAdmUid="logon@tenant2.onmicrosoft.com" ; Tenant 2 cloud-only admin acct | |
# flag that switches from federated/broken SID acct to cloud only $o365COAdmUid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Confirm User has RemoteMailbox in OnPrem mail system | |
# Note: Preconnect to onprem EX remote ps & EXO | |
# To differentiate targets, I prefix _EXO_ cmdlets with [verb]-exo[noun]) | |
# on-prem cmdlets are _un-prefixed_ | |
$tAddress = "UserUPN@DOMAIN.com" ; | |
# pull local recipient type | |
$rcp = get-recipient $tAddress ; | |
$rcp | ft -a alias, primar*, recipientt* ; | |
$rmbx = get-remotemailbox -id $rcp.PrimarySmtpAddress ; | |
$rmbx | format-table -auto Name, RecipientTypeD*, userprin* ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Confirm User has RemoteMailbox in OnPrem mail system | |
# Note: Preconnect to onprem EX remote ps & EXO | |
# To differentiate targets, I prefix _EXO_ cmdlets with [verb]-exo[noun]) | |
# on-prem cmdlets are _un-prefixed_ | |
$tAddress = "UserUPN@DOMAIN.com" ; | |
# pull local recipient type | |
$rcp = get-recipient $tAddress ; | |
$rcp | ft -a alias, primar*, recipientt* ; | |
$rmbx = get-remotemailbox -id $rcp.PrimarySmtpAddress ; | |
$rmbx | format-table -auto Name, RecipientTypeD*, userprin* ; |