Category: Microsoft Windows Server 2016

Microsoft Windows PowerShell – Resolve-DnsName

You may use the Resolve-DnsName Microsoft Windows PowerShell cmdlet to perform Domain Name System (DNS) query resolution for the domain name(s) you specify. Below you will find a few examples of this cmdlet.

To perform a standard query enter Resolve-DnsName domain.com.

To perform a query without the use of a local hosts file or DNS cache enter Resolve-DnsName domain.com -NoHostsFile.

To perform a query only using the DNS client cache enter Resolve-DnsName domain.com -CacheOnly. NOTE: In this example, the DNS client cache is cleared, first. Therefore, the error is expected.

To perform a query while specifying a particular DNS server enter Resolve-DnsName domain.com -Server X.X.X.X.

To perform a query for a specific DNS record enter Resolve-DnsName domain.com -Type XX.

To perform a query of multiple domains enter domain.com“,”domain.com“,”domain.com” | Resolve-DnsName

To perform a query of domain names using a file enter Get-Content file | Resolve-DnsName. NOTE: I do not recommend placing the file in the C:\Windows\System32 directory. However, I used that directory in this example for simplicity.


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


Microsoft Windows PowerShell – Remote Server Uptime

The Microsoft Windows PowerShell script below will request the hostname of a server then provide it’s uptime using Event ID 6005.

<#
.SYNOPSIS
This script will request the hostname of a server then provide it’s uptime.
.DESCRIPTION
This script will request the hostname of a server then provide it’s uptime.
.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?”

#Provide the uptime of the server
Get-EventLog -Logname System -ComputerName $HOSTNAME | Where-Object {$_.EventID -EQ 6005} | Select-Object -First 1

#End of script


Microsoft Active Directory – Get Computer Object Last Logon Time

You may use the following Microsoft PowerShell cmdlet to determine the last logon time for a Microsoft Active Directory (AD) computer object.

Get-ADComputer HOSTNAME -Properties LastLogonDate


Microsoft Exchange Server 2016 – Prerequisites

The implementation of Microsoft Exchange Server 2016, like any other critical component of an Information Technology (IT) infrastructure, has prerequisites. These includes prerequisites for Microsoft Active Directory (AD) as well as the operating system.

Microsoft has provided a list of the prerequisites for Microsoft Exchange Server 2016. That documentation may be found here.