segunda-feira, 12 de agosto de 2019

PowerShell – BGInfo Automation script for Windows Server 2019

PowerShell – BGInfo Automation script for Windows Server 2019

Probably everyone knows the Sysinternals tool BGInfo (currently version 4.26). For those who don’t, it’s a great free tool from Microsoft which captures system information form a workstation or server (probably where it is the most useful) and displays that relevant data directly on the desktop of that particular machine. It can show useful information like, DNS settings, used IP Addresses, computer name, domain name, OS version, memory, service pack version, etc.
image
Whenever I create a new Windows Server 2019 Virtual Machine (VM) template for customers, I mostly add this tool in the base image (also called golden image) and set it so it starts up automatically whenever a user logs on to the server. To automate this process, I wrote a PowerShell script which automates the complete BGInfo installation and configuration.
This script will do all of the following:
  • Create the BGInfo folder on the C: drive if the folder does not already exist.
  • Download the latest BGInfo tool from the Sysinternals webpage.
  • Extract and cleanup the BGInfo.zip file in the BGInfo folder.
  • Download the logon.bgi file which holds the preferred settings.
  • Extract and cleanup the LogonBgi.zip file in the BGInfo folder.
  • Create the registry key (regkey) to AutoStart the BGInfo tool in combination with the logon.bgi config file.
  • Start BGInfo for the first time.
  • Exit the PowerShell window upon completion.

Prerequisites

  • Windows PowerShell 5.1
  • Run PowerShell as Administrator

PowerShell script

To use the script copy and save the above as BGInfo_Automated_Windows_Server_2019.ps1 or download it from the TechNet Gallery. Afterwards run the script with Administrator privileges from the server you wish to use for your VM template.
image
image
image
image
image
image
If you want to change any configuration setting (for example the font style or published info), just open the logon.bgi file and adjust the settings to your preferences. Click OK to save and set the new settings.
image
image
Hope this script comes in handy for you. If you have and questions or recommendations about it, feel free to contact me through my Twitter handle.

fonte: http://scug.be/wim/2019/01/23/powershell-bginfo-automation-script-for-windows-server-2019/

0 comentários: