Resolving issue with website not running locally on port 443

I recently had issue an issue with a website not working locally on port 443. I figured out that another service was using this port, which was Skype.

I figured this out by following the steps below that I discovered on the the webpage http://www.tonerdesign.biz/web-design/46-learning-about-netstat.html

  • Run the following command on Command prompt:
    netstat -aon
  • Read through the result to see what is listening to port 443 and take a note of the PID
  • Finally open task manager and view processes. Sort processed by PID and locate PID in question. If PID column isnt shown you will need to add it

Allowing Internals to be visible to a Unit Test class assembly

I previously had the need for an Internal method to be visible to a Unit Test class assembly.  This was done by adding the full qualified namespace of the test assembly to the AssemblyInfo.cs file in the project with the class with the Internal method.  

An example of this is below:

[assembly: InternalsVisibleTo("MyDomain.Function.UnitTests")]

PowerShell scripts to remotely manage Windows Services

Following on from a previous post I published on how to remotely manage IIS via PowerShell scripts I thought it would be useful to detail how to also manage Windows Services remotely.

RESTART A WINDOWS SERVICE
Get-Service -Name [INSERT_SERVICE_NAME]  -ComputerName [INSERT_COMPUTER_NAME] | Restart-service

Example:

Get-Service -Name Jonathan.Welch.Test.Service  -ComputerName jon-app-01 | Restart-service
STOP A WINDOWS SERVICE
Get-Service -Name [INSERT_SERVICE_NAME]  -ComputerName [INSERT_COMPUTER_NAME] | Stop-service

Example:

Get-Service -Name Jonathan.Welch.Test.Service  -ComputerName jon-app-01 | Stop-service
START A WINDOWS SERVICE
Get-Service -Name [INSERT_SERVICE_NAME]  -ComputerName [INSERT_COMPUTER_NAME] | Start-service

Example:

Get-Service -Name Jonathan.Welch.Test.Service  -ComputerName jon-app-01 | Start-service
START A DISABLED WINDOWS SERVICE
Get-WmiObject Win32_Service -ComputerName [INSERT_COMPUTER_NAME] | ? { $_.Name -Match '[INSERT_SERVICE_NAME]' -and $_.StartMode -ne 'Disabled' } | % { $_.StartService() }

Example:

Get-WmiObject Win32_Service -ComputerName jon-app-01 | ? { $_.Name -Match 'Jonathan.Welch.Test.Service' -and $_.StartMode -ne 'Disabled' } | % { $_.StartService() }

Note that in the examples above you can append a * to the end of service name to find services that match that name. So you could shorten the name to Jonathan.Welch* to find all services with names that start with Jonathan.Welch