Wednesday, March 20, 2019

Use Nmap to Scan for Unused IPs

So I have a customer who can't use DHCP, and I'm adding phones. Their IPs are all over the place, and managed through a (somewhat inaccurate) spreadsheet - what to do? Nmap to the Rescue!

sudo nmap -v -sn -n 192.168.1.0/24 -oG - | awk '/Status: Down/{print $2}'

For a slower and more accurate scan, try:

 for ip in 192.168.1.{1..254}; do { ping -c 1 -W 1 $ip ; } &> /dev/null || echo $ip & done | sort

Friday, February 22, 2019

Allow a User to Access All O365 Mailboxes

Connect to O365 using powershell then issue the following, replacing the user with a proper user:

Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Add-MailboxPermission -User SOMEUSER@SOMEDOMAIN.COM -AccessRights FullAccess -InheritanceType all

To turn it off, change Add-MailboxPermission to Remove-MailboxPermission

Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Remove-MailboxPermission -User SOMEUSER@SOMEDOMAIN.COM -AccessRights FullAccess -InheritanceType all