Archive
Archive for January, 2019
[CMD] Add persistent route
January 25, 2019
No comments
show ipv4 route
netsh interface ipv4 show route
id idx (interface)
route print
add persistent route, bind to interface
route -p add mask 255.255.255.0 192.168.1.170 if
registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip \Parameters\PersistentRoutes
Categories: Uncategorized
[PS] Hash Map
January 16, 2019
No comments
Exploring Hashmaps in Powershell
1 |
1 2 3 4 5 6 7 8 9 |
$keep = @{} //declare an empty hashmap /* Next add all the shared mailboxes to the hashmap */ $keep = get-mailbox | ? { $_.recipienttypedetails -eq 'sharedmailbox' } | % { $keep.add($_.name,$_.primarysmtpaddress) } /* Big assumption for this next portion: I'll assume you've put the list of items you want to clean up in a csv with at least a DisplayName and EmailAddress (assuming PrimarySMTP) column */ $cleanup = import-csv /path/to/csv/file.csv $cleanup | % { if (-not $keep.containskey($_.displayname)) { remove-mailbox -identity $_.displayname } } |
1 |
1 2 3 4 5 6 7 |
$myList = New-Object Collections.Generic.List[string] $myList.Add("one") $myList.Add("two") $myList.Add("three") $myHash = @{ } $myHash.Add("list", $myList) |
1 |
Categories: Powershell
[XLS]Check if one column value exists in another column using MATCH
1 |
=NOT(ISERROR(MATCH(A2,$B$2:$B$1001,0))) |
Categories: Excel
[TIP] Trouble shooting port 25 smtp in LINUX
January 11, 2019
No comments
Troubleshooting Linux e-mail issues.
netstat :
netstat -a | more
shows all listening ports of tcp and udp connections
netstat -at
shows all listening ports connected
netstat -plnt | grep ‘:25’
ss :
ss -lntu | grep ‘:25’
nmap :
nmap -sT -O localhost | grep 25
lsof:
lsof -i:25
telnet myserver.com 25
Categories: Uncategorized
[PS] Get Mailbox Size and Item Count
January 7, 2019
No comments
1 |
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select DisplayName, ItemCount, TotalItemSize | Export-CSV C:\temp\results.csv |
Categories: Exchange, Powershell