Search This Blog

Monday, March 21, 2016

Domino Port Audit

Pretend some server admins were going to change out their IPs from their 208 addresses for some new IPs and you needed to test for connectivity for all the IPs involved; server and services. You may want to do something similar to the following...

## The Scripting Guys Test-Port script
## https://gallery.technet.microsoft.com/scriptcenter/97119ed6-6fb2-446d-98d8-32d823867131

## Pretend I got IBM Domino servers in cluster pairs like this...
 app001/srv/mycompany 10.10.10.23
 app011/srv/mycompany 10.10.10.24
 app021/srv/mycompany 208.109.4.218   # godaddy.com is not my server.
 app022/srv/mycompany 208.109.4.219   # I don't know who this is.
 app002/srv/mycompany 10.10.2.54
 app012/srv/mycompany 10.10.2.55

## From a cmd I can issue these commands and capture the results
ping 10.10.10.23
ping 10.10.10.24
ping 208.109.4.218
ping 208.109.4.219
ping 10.10.2.54
ping 10.10.2.55

tracert 10.10.10.23
tracert 10.10.10.24
tracert 208.109.4.218
tracert 208.109.4.219
tracert 10.10.2.54
tracert 10.10.2.55

## I Want to see the successful connection to the NRPC port
start telnet 10.10.10.23 1352
start telnet 10.10.10.24 1352
start telnet 208.109.4.218 1352
start telnet 208.109.4.219 1352
start telnet 10.10.2.54 1352
start telnet 10.10.2.55 1352

## Domino console batch saved as trace.txt and piped in to the console
trace 10.10.10.23
trace 10.10.10.24
trace 208.109.4.218
trace 208.109.4.219
trace 10.10.2.54
trace 10.10.2.55
## When your done with this you can search the log for messages like...
## Network: 10.10.10.23 is the server address of server CN=app001/OU=srv/O=mycompany
## I typically just search on " is the server address of server CN=" 
## Make sure to include the double quotes.

## Singular test 
$tcpObject = New-Object System.Net.Sockets.TcpClient
$tcpConnect = $tcpObject.BeginConnect('10.10.10.23','1352',$null,$null)
$tcpConnect.AsyncWaitHandle.WaitOne(1000)
$tcpObject.Close()

## playing around
$Server = '10.10.10.23'
$Server = '10.10.10.24'
$Server = '208.109.4.218'
$Server = '208.109.4.219'
$Server = '10.10.2.54'
$Server = '10.10.2.55'

## Lets to a batch
$ServerList = @('10.10.10.23',
                '10.10.10.24',
                '208.109.4.218',
                '208.109.4.219',
                '10.10.2.54',
                '10.10.2.55')
$port=1352
foreach($Server in $ServerList){
   $tcpObject = New-Object System.Net.Sockets.TcpClient
   $tcpConnect = $tcpObject.BeginConnect($Server,$port,$null,$null)
   $wait = $tcpConnect.AsyncWaitHandle.WaitOne(1000)
   ($server+" "+$wait)
   $wait=$null
   $tcpObject.Close()
}
This batch audit at the end creates a result similar to ...
10.10.10.23 True
10.10.10.24 True
208.109.4.218 False
208.109.4.219 False
10.10.2.54 True
10.10.2.55 True

Tuesday, March 8, 2016

Getting Started with Powershell and Office365 scripting

Here's what I know today...
# Managing Office 365 and Exchange Online with Windows PowerShell
# https://support.office.com/en-us/article/Managing-Office-365-and-Exchange-Online-with-Windows-PowerShell-06a743bb-ceb6-49a9-a61d-db4ffdf54fa6

#Connect to Office 365 PowerShell
$UserCredential = Get-Credential
$MsolService = Connect-MsolService -Credential $UserCredential
    # do stuff here like... 
    Get-Module
    Get-Command -Module MSOnline
# no remove: https://technet.microsoft.com/en-us/library/dn568015.aspx#Step8

# Connect to Exchange Online using remote PowerShell
Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
    # do stuff here like... 
    Get-Module
    Get-Command -Module tmp_mjopwmqk.4nu #or whatever it is named

Remove-PSSession $Session

# Connect to Office 365 Compliance Center PowerShell - need a role first
Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
    # do stuff here?
Remove-PSSession $Session #Security limits 3 connections only - Clean up!

# Connecting to Skype for Business Online by using Windows PowerShell 
$UserCredential = Get-Credential
$Session = New-CsOnlineSession -Credential $UserCredential
    # do stuff here
Remove-CsOnlineSession $Session

# Set up the SharePoint Online Management Shell Windows PowerShell environment 
$UserCredential = Get-Credential
$URL ='https://MyCompany-my.sharepoint.com'
Connect-SPOService -Url $URL -credential $UserCredential
    # do stuff here
Disconnect-SPOService

I wonder what I'll know tomorrow...