13 February 2018

Check if RSAT is installed with this one-liner

You are installing RSAT in a build, and you want to check if it is installed if it is included in the windows updates. Recently, there has been the issue in Windows 10 where RSAT cannot be found in the Windows Features. It is also not found in the Win32_OptionalFeature. To work around this, I have this one-liner incorporate checking for the feature first and if that turns up nothing, it then checks for the active directory module, which exists if RSAT has been installed. It will return an exit code of 0 for success and 1 for failure which can be used to either pop up a warning or kill a build if not present. This has been tested on both Windows 7 and Windows 10.

powershell.exe -command "&{If ((Get-WmiObject -class win32_optionalfeature | Where-Object { $_.Name -eq 'RemoteServerAdministrationTools'}) -ne $null) {Exit 0} else {If ((Get-Module -Name ActiveDirectory -ListAvailable) -ne $null) {Exit 0} else {Exit 1}}}"

Related Posts:

  • Automated Dell Command Update While working on implementing the new Windows 10 build, I decided to update the Dell Command | Update process. The old script was still looking at the old DCSU and had many inefficiencies that needed to be updated. I a… Read More
  • Report Last Reboot Time to SCCM We have started switching users over from desktops to laptops. In doing so, we realized that a good number of the laptops have not been rebooted in quite a while. The problem comes from sleep and hibernation mode. The LastB… Read More
  • Bitlocker Recovery Password Utility Recently, we encountered an issue where we found out a few systems did not have the BitLocker recovery password backed up to active directory. We have the GPO in place that pushes that key to AD, but for some reason, a… Read More
  • Clearing Specific Print Queues In a recent deployment, we ran into an issue where there had been print jobs stuck in the print que on some machines. We thought we had it fixed by running the following cmdlet: Get-WmiObject Win32_Printer | where-object {… Read More
  • Event 51 Drive Failure Reporting Tool Last year, we had a high level executive that started having slowness and extended drive usage. When the help desk evaluated his system, they found it had been writing an event 51 to the event viewer logs. They were able to… Read More

0 comments:

Post a Comment