Category: Services

Microsoft Windows PowerShell – Remote Server Service Status

The Microsoft Windows PowerShell script below will request the hostname of a server as well as the service to be queried then provide the status of the service.

<#
.SYNOPSIS
This script will request the hostname of a server, the name of the service, then provide it’s status.
.DESCRIPTION
This script will request the hostname of a server, the name of the service, then provide it’s status.
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Thursday, November 11, 2018.
#>

#Request the hostname of the server
$HOSTNAME = Read-Host “What is the hostname of the server?”

#Request the name of the service
$SERVICE = Read-Host “What is the name of the service?”

#Provide the status of the service
Get-Service -Name $SERVICE -ComputerName $HOSTNAME

#End of script


VMware vCenter Server 6.0 – Verify the Status of Critical Services Locally

The script below will query the status of the service(s) specified in “C:\Scripts\VMware vCenter Server\Verify_Critical_Services.txt” on the local server. The output of the script will provide the name and status of the service(s) in a formatted list for your viewing. Additionally, it is recommended that the following services be queried as they are critical to the proper functioning of VMware vCenter Server 6.

  • VMware VirtualCenter Server (vpxd)
  • VMware Inventory Service (invsvc)
  • VMware vSphere Web Client (vspherewebclientsvc)

<#
.SYNOPSIS
This script will provide the name and status of the service(s) defined in “C:\Scripts\VMware vCenter Server\Verify_Critical_Services.txt”
.DESCRIPTION
This script will automate the process of providing the status of critical VMware vCenter Server 6 service(s) on the local server
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Wednesday, November 22, 2017.
#>

#Define the service(s) to query
$Services = Get-Content “C:\Scripts\VMware vCenter Server\Verify_Critical_Services.txt”

#Query the status of the service(s) in “C:\Scripts\VMware vCenter Server\Verify_Critical_Services.txt”
ForEach ($Service in $Services)
{Get-Service $Service |
Format-List -Property Name, Status}


Microsoft Windows Server 2012 R2 – Start a Service

You may use the Microsoft Windows PowerShell script below to start a service, remotely.

<#
.SYNOPSIS
This script will a service on the specified server.
.DESCRIPTION
This script automates the process of starting a service.
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Thursday, March 03, 2016.
#>

#Request the hostname of the server and the name of the service
$SERVER = Read-Host “What is the hostname of the server?”
$SERVICE = Read-Host “What is the name of the service?”

#Request the status of the service
get-service -computername $SERVER | where-object {$_.name -eq “$SERVICE”}

#Pause for (5) seconds
Start-Sleep 5

#Start the service
get-service -name $SERVICE -computername $SERVER | set-service -status running

#Pause for (5) seconds
Start-Sleep 5

#Request the status of the service
get-service -computername $SERVER | where-object {$_.name -eq “$SERVICE”}

#End of script


VMware vCenter Server 6.0 – Verify the Status of Critical Services

The script below will query the status of the VMware VirtualCenter Server (vpxd), VMware Inventory Service (invsvc) and VMware vSphere Web Client (vspherewebclientsvc) services on the specified server hosting an instance of VMware vCenter Server 6.0.

<#
.SYNOPSIS
This script will provide the status of the VMware VirtualCenter Server (vpxd), VMware Inventory Service (invsvc) and VMware vSphere Web Client (vspherewebclientsvc) services on VCENTER01.ROOT.SYSADMIN.NET.
.DESCRIPTION
This script will automate the process of providing the status of the VMware VirtualCenter Server (vpxd), VMware Inventory Service (invsvc) and VMware vSphere Web Client (vspherewebclientsvc) services on VCENTER01.ROOT.SYSADMIN.NET.
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Friday, March 25, 2016.
#>

#Query the status of the VMware VirtualCenter Server (vpxd), VMware Inventory Service (invsvc) and VMware vSphere Web Client (vspherewebclientsvc) services on VCENTER01.ROOT.SYSADMIN.NET
Get-Service -ComputerName VCENTER01 | Where-Object {$_.name -eq “vpxd”}
Get-Service -ComputerName VCENTER01 | Where-Object {$_.name -eq “invsvc”}
Get-Service -ComputerName VCENTER01 | Where-Object {$_.name -eq “vspherewebclientsvc”}


VMware vCenter Server 5.0 – Verify the Status of Critical Services

The script below will query the status of the VMware Virtual Center Server (vpxd) and vCenter Inventory Service (vimQueryService) services on the specified server hosting an instance of VMware vCenter Server 5.0.

<#
.SYNOPSIS
This script will provide the status of the VMware Virtual Center Server (vpxd) and vCenter Inventory Service (vimQueryService) services on VCENTER01.ROOT.SYSADMIN.NET.
.DESCRIPTION
This script will automate the process of providing the status of the VMware Virtual Center Server (vpxd) and vCenter Inventory Service (vimQueryService) services on VCENTER01.ROOT.SYSADMIN.NET.
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Friday, March 25, 2016.
#>

#Query the status of the VMware Virtual Center Server and vCenter Inventory Service services on VCENTER01.ROOT.SYSADMIN.NET
Get-Service -ComputerName VCENTER01 | Where-Object {$_.name -eq “vpxd”}
Get-Service -ComputerName VCENTER01 | Where-Object {$_.name -eq “vimQueryService”}



VMware vCenter Server 6.0 – Critical Services

You may consider monitoring the following services if you utilize VMware vCenter Server 6.0 in your virtualized infrastructure.

1. VMware VirtualCenter Server (vpxd)
2. VMware Inventory Service (invsvc)
3. VMware vSphere Web Client (vspherewebclientsvc)

Enjoy!


Microsoft Windows PowerShell – Get Service Status and Start Service

The Microsoft Windows PowerShell script below will provide the status of a service on the specified server, start the service, then provide the status of the service, again.

<#
.SYNOPSIS
This script will a service on the specified server.
.DESCRIPTION
This script automates the process of starting a service.
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Thursday, March 03, 2016.
#>

#Request the hostname of the server and the name of the service
$SERVER = Read-Host “What is the hostname of the server?”
$SERVICE = Read-Host “What is the name of the service?”

#Request the status of the service
get-service -computername $SERVER | where-object {$_.name -eq “$SERVICE”}

#Pause for (5) seconds
Start-Sleep 5

#Start the service
get-service -name $SERVICE -computername $SERVER | set-service -status running

#Pause for (5) seconds
Start-Sleep 5

#Request the status of the service
get-service -computername $SERVER | where-object {$_.name -eq “$SERVICE”}