Don’t Ask!

#VirginMedia So been away for a week and noticed last Sunday that I could not connect to this site or RDP home.

Get home last night to discover that my Virgin Media SuperHub isn’t so super.  It was dead!!  Checked out the power supply and found a similar one and yeah baby it came back up!

Get this, it has done a factory reset?! WTF don’t know what is going on .. Me thinks virgin has performed an upgrade (like it does) and toasted the SuperHub! .. The reset also cleared all my port rules and defaulted back to 192.168.0.x instead of .1.x.

Couldn’t for the life of me workout how to change it, so been re-iping all my VM’s and getting this blog back to land of the living! .. which is another thing.  For some reason I lost all my posts since January?  Not got a clue why or what the hell is going on, but let see how things go!

Should get my replacement SuperHub on Tuesday so I get the power supply back for a wireless access point I have .. Hay-Ho

Don't Ask!

#VirginMedia So been away for a week and noticed last Sunday that I could not connect to this site or RDP home.

Get home last night to discover that my Virgin Media SuperHub isn’t so super.  It was dead!!  Checked out the power supply and found a similar one and yeah baby it came back up!

Get this, it has done a factory reset?! WTF don’t know what is going on .. Me thinks virgin has performed an upgrade (like it does) and toasted the SuperHub! .. The reset also cleared all my port rules and defaulted back to 192.168.0.x instead of .1.x.

Couldn’t for the life of me workout how to change it, so been re-iping all my VM’s and getting this blog back to land of the living! .. which is another thing.  For some reason I lost all my posts since January?  Not got a clue why or what the hell is going on, but let see how things go!

Should get my replacement SuperHub on Tuesday so I get the power supply back for a wireless access point I have .. Hay-Ho

PortQry ALL Domain Controllers using #Powershell

So I don’t trust my network guys (sorry) as they say all ports are open but think they is not telling me the trust.

So knocked this up to test. You need to download PortQry from here: http://www.microsoft.com/en-us/download/details.aspx?id=17148

Change $PortQryExe to the location of the .exe

$matrix = @()
$PortQryExe = “Y:ToolsPortQryV2PortQry.exe”
$Ports2Scan = “udp-389″, “tcp-389″, “tcp-135″, “udp-135″, “udp-88″, “tcp-88″, “udp-445″, “tcp-445″, “tcp-1025″
$PortCnt = $Ports2Scan.count
$Fields = @();$fields += “Server”; $fields += $Ports2Scan

Write-Host “`nGetting Domain Controllers [$Server]”
$forest = [System.DirectoryServices.ActiveDirectory.Forest]::getcurrentforest()
$domains = $forest.domains
$servers = @()
$intDCcnt = 0
ForEach($Domain in $domains){
Write-Host $Domain.Name
$tmpDCs = $Domain.DomainControllers
ForEach($tmpDC in $tmpDCs){$servers += $tmpDC.name;$intDCcnt ++}
}
Write-Host ” -$intDCcnt Found” -Foregroundcolor Green

ForEach($Server in $Servers){
Write-host $Server
$tmpMatrix = “” | Select $Fields
$tmpMatrix.Server = $Server
For($i=0;$i -le $PortCnt -1;$i++){
$tmpPort2Scan = ($Ports2Scan[$i]).split(“-”)
$Protocol = $tmpPort2Scan[0]
$port = $tmpPort2Scan[-1]
$cmd = $PortQryExe + ” -n ” + $Server + ” -p ” + $Protocol + ” -e ” + $port

Write-Host ” – $cmd”
$Output = Invoke-Expression $cmd
$Output = $Output | Where {$_}
$tmpOutput = “” | Select Host, Server, Protocol, Port, Service, Status, Result
$tmpOutput.Host = (HOSTNAME)
$tmpOutput.Server = $Server
$tmpOutput.Protocol = $Port.Protocol
$tmpOutput.Port = $Port.port
$tmpOutput.Result = $Output[-1]

$tmpSplit = $tmpOutput.Result.Split(“:”)
$tmpOutput.Service = $tmpSplit[0]
$tmpOutput.Status = $tmpSplit[-1].trim()
Write-host ” +-” $tmpOutput.Result

$tmpMatrix.($Ports2Scan[$i]) = $tmpOutput.Result
}
$matrix += $tmpMatrix
}

$Matrix

The result is an array that you can export to csv and use some excel love on it.

Enjoy

Get a List of InSite DCs from Eventlog

#MsExchange #Powershell

So I have been having a bit of fun (well not really). The company I am working for has multiple AD domains in a single forest and the users are spread over the domains.

To start with, with almost every Exchange Management Shell cmdlet I run I need to also run the following:

Set-AdServerSettings -ViewEntireForest $True

Now with mailbox move requests, the exchange servers are in one domain and the users in another. I wanted a way to take the output from the MSExchange ADAccess 2080 event in the application event log and generate an array I can then play with in a script. I then use the array to use the right DC with the -DomainController switch. I came up with this:

$Evt2080 = Get-EventLog Application -Source “MSExchange ADAccess” | where {($_.Category -eq “Topology”) -AND ($_.EventId -eq 2080)} | Select -first 1

$InSiteMatrix = @()
$Fields = “Server”, “Roles”, “Enabled”, “Reachability”, “Synchronized”, “GCcapable”, “PDC”, “SACLright”, “CriticalData”, “Netlogon”, “OSVersion”
$InSite = ($Evt2080.ReplacementStrings[-2]).Split(“`n”) | Where {$_}
ForEach($Item in $InSite){
$tmpMatrix = “” | Select $Fields
$tmpSplit = $item.Split(“`t”)
$tmpMatrix.Server = $tmpSplit[0]
If($tmpMatrix.Server -ne “”){
$i=1
$tmpValues = $tmpSplit[-1].split(” “)
ForEach($thing in $tmpValues ){
$tmpMatrix.($Fields[$i]) = $thing
$i++
}
$InSiteMatrix += $tmpMatrix
}
}

$InSiteMatrix

Enjoy