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
<# -- 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
$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
<# 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
<# 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
<# 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
<# 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
# Array of IIS paths, stored as semi-colon-delimited string | |
$LogDirs="\\US-HUBCAS1\e$\Weblogs\W3SVC1\;\\US-HUBCAS2\e$\Weblogs\W3SVC1\" ; $LogDirs=$LogDirs.split(";") ; | |
# constants for single & double quotes | |
$sQuot = [char]34 ; $sQuotS = [char]39 ; | |
foreach ($LogDir in $LogDirs) { | |
# build the log path to today's logs | |
$sTodaysLogsStr = $LogDir ; | |
# Ex2007 IIS log filename variant | |
#$sTodaysLogsStr += "ex" ; | |
# Ex2010 variant |
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
$Sites = "US;AU;EU" ; | |
$Sites=$Sites.split(";") ; | |
foreach ($Site in $Sites) { | |
write-host -foregroundcolor yellow "SITE: " $Site; | |
get-exchangeserver | | |
where { $_.Site -like "*$Site" } | | |
sort AdminDisplayVersion,ServerRole,Name | | |
select Name,ServerRole,AdminDisplayVersion ; | |
} ; |
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 Comment-based Help (leave blank line below) V---------- | |
<# | |
.SYNOPSIS | |
[NAME].ps1 - [1-LINE-DESC] | |
.NOTES | |
Written By: Todd Kadrie | |
Website: http://tinstoys.blogspot.com | |
Twitter: http://twitter.com/tostka |