April 22 2015

How to find an internal/local Certificate Authority



----------------------------------------------------------------------------
I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.

----------------------------------------------------------------------------

Many times when I’m new to an organisation I’ll need to do a discovery within the environment to see what technology exists – including local Microsoft Windows Certificate Authorities. A very quick and easy way to do this is to use the certutil command with the follow syntax:

certutil -config - -ping

If there is a Certificate Authority published in Active Directory then you will get a popup box with a list of them. If not, you’ll see something like this:

certutil
certutil

The command is also useful for testing the responsiveness of a Certificate Authority – if you select an existing Certificate Authority from the popup box, certutil will ping it.



----------------------------------------------------------------------------
I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.

----------------------------------------------------------------------------

March 31 2014

Powershell script to ping and check ports 80 & 443

A while back I created a very simple PS script for pinging a list of servers (http://blog.danovich.com.au/2009/06/10/nifty-powershell-script-to-ping-multiple-servers/). I’ve make a few changes to it recently including a couple of columns to check for TCP port 80 & 443 connectivity. Expect an output to Excel similar to this:

Ping script

 

 
$erroractionpreference = "SilentlyContinue"
$a = New-Object -comobject Excel.Application
$a.visible = $True
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "Machine Name"
$c.Cells.Item(1,2) = "Ping Status"
$c.Cells.Item(1,3) = "IP Address"
$c.Cells.Item(1,4) = "Port 80"
$c.Cells.Item(1,5) = "Port 443"
$d = $c.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True
$d.EntireColumn.AutoFit($True)
$intRow = 2
$colComputers = get-content C:Tempmachinelist.txt
foreach ($strComputer in $colComputers)
{
$c.Cells.Item($intRow, 1) = $strComputer.ToUpper()
# This is the key part
$ping = new-object System.Net.NetworkInformation.Ping
$Reply = $ping.send($strComputer)
if ($Reply.status -eq "Success")
{
$c.Cells.Item($intRow, 2) = "Resolved & active"
$c.Cells.Item($intRow, 3) = $Reply.Address.ToString()
}
elseif ($Reply.status -eq "TimedOut")
{
$c.Cells.Item($intRow, 2) = "Resolved host but timed out"
$c.Cells.Item($intRow, 3) = $Reply.Address.ToString()
}
else
{
$c.Cells.Item($intRow, 2) = "Unable to resolve"
}

$socket80 = new-object Net.Sockets.TcpClient
$socket80.Connect($strComputer, 80)
if ($socket80.Connected) {
$c.Cells.Item($intRow, 4) = "Open"
$socket80.Close()
}
else 
{
$c.Cells.Item($intRow, 4) = "Not Open"
}

$socket443 = new-object Net.Sockets.TcpClient
$socket443.Connect($strComputer, 443)
if ($socket443.Connected) {
$c.Cells.Item($intRow, 5) = "Open"
$socket443.Close()
}
else 
{
$c.Cells.Item($intRow, 5) = "Not Open"
}

$Reply = ""
$intRow = $intRow + 1
}
$d.EntireColumn.AutoFit()

 

 

 

September 5 2011

Tool for pinging multiple hosts

I came across a great tool called Ping Them, great for pinging multiple hosts. See http://blogs.microsoft.co.il/blogs/doli/archive/2011/08/17/free-tool-ping-them.aspx for more details.

This is similar to a Powershell script of mine over here – http://blog.danovich.com.au/2009/06/10/nifty-powershell-script-to-ping-multiple-servers/ – but this new tool adds a great GUI and some additional functionality.
 
 

June 10 2009

Nifty Powershell script to ping multiple servers

This great Powershell script will ping all machines listed in a text file and put the live results into a Excel workbook:

$erroractionpreference = "SilentlyContinue"
$a = New-Object -comobject Excel.Application
$a.visible = $True
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "Machine Name"
$c.Cells.Item(1,2) = "Ping Status"
$d = $c.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True
$d.EntireColumn.AutoFit($True)
$intRow = 2
$colComputers = get-content C:\temp\server_list.txt
foreach ($strComputer in $colComputers)
{
$c.Cells.Item($intRow, 1) = $strComputer.ToUpper()
# This is the key part
$ping = new-object System.Net.NetworkInformation.Ping
$Reply = $ping.send($strComputer)
if ($Reply.status -eq "Success")
{
$c.Cells.Item($intRow, 2) = "Resolved & active"
}
elseif ($Reply.status -eq "TimedOut")
{
$c.Cells.Item($intRow, 2) = "Resolved host but timed out"
}
else
{
$c.Cells.Item($intRow, 2) = "Unable to resolve"
}
$Reply = ""
$intRow = $intRow + 1
}
$d.EntireColumn.AutoFit()