Month: November 2018

Microsoft Windows Server 2008 R2 – Disk Cleanup Installation

By default, the Disk Cleanup utility is not present on Microsoft Windows Server 2008 R2. However, copying the files below to the appropriate directories will make the utility available for use. After the files have been copied enter the command Cleanmgr.exe into a command prompt or Microsoft Windows PowerShell session to start the utility. Lastly, further documentation may be found here.

C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe > %systemroot%\System32

C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui > %systemroot%\System32\en-US


Microsoft Windows PowerShell – DHCP Logs

You may use the following Microsoft Windows PowerShell cmdlet to view the last one hundred lines of a Microsoft Windows Server DHCP server log for a particular Internet Protocol (IP) address. This may be useful when you are troubleshooting DHCP errors in Microsoft Windows Server.

Get-Content DhcpSrvLog-Mon.log | Select -Last 100 | Select-String -Pattern “X.X.X.X” -encoding ASCII


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