Showing posts with label Windows Server 2016. Show all posts
Showing posts with label Windows Server 2016. Show all posts

Saturday, August 11, 2018

PowerShell Script: Get AD Domain and Forest functional level

Simple script to show Active Directory domain and forest functional level, FSMO roles, all sites in the forest, Global Catalog servers.

Link for download
.\Get-ADInfo.ps1

Example of usage:
[PS].\Get-ADInfo.ps1

Tuesday, August 7, 2018

Automate WSUS Server Cleanup on Windows Server 2016 with PowerShell

I had a task to automate wsus server cleanup on windows server 2016.
For this task I used one windows server 2016 powershell command

Invoke-WsusServerCleanup

Invoke-WsusServerCleanup performs the process of cleanup on a specified WSUS server. This process has the same impact as running the Cleanup Wizard from the WSUS Console and allows the specification of the same options as Cleanup Wizard.

In my case I added tasks in Task Scheduler on WSUS Server to run powershell with command:

Task 1. 
Name: WSUS-Cleanup
Task running: Weekly
Description: Cleanup obsolete computers and obsolete updates, delete unneeded updates and obsolete revisions to updates, declines expired updates, declines superseded updates
Command:

[PS]Get-WsusServer | Invoke-WsusServerCleanup -CleanupObsoleteComputers -CleanupObsoleteUpdates -CleanupUnneededContentFiles -CompressUpdates -DeclineExpiredUpdates -DeclineSupersededUpdates


Task 2.
Name: WSUS-Cleanup-Computers 
Task running: Daily
Description: Cleanup for obsolete computers
Command:

[PS]Get-WsusServer | Invoke-WsusServerCleanup -CleanupObsoleteComputers



Sunday, July 2, 2017

Install VMware Tools On Windows Server 2012 R2 / 2016 Core

 
Open the Virtual Machine Console -> VM -> Guest -> Install/Upgrade VMware Tools
 
 
Example 1.
In Command prompt type PowerShell
 
Check where the Vmware Tools are mounted on
 
[PS] Get-Psdrive
 
Go to the Drive with Vmware Tools
 
[PS] D:
 
[PS] .\setup64.exe
 
 
 
Follow the steps and restart when completed.
 
When install VMTools done - restart the server:
[PS] Restart-Computer
 
Example 2.
Enter the following command:     

D:\>setup64.exe /S /v "/qn REBOOT=Y"
 
 
Command prompt will return to D:\>. For a minute or two the installation is done than server will reboot.