Quantcast
Viewing all articles
Browse latest Browse all 2279

Commented Issue: Win32_Products to be avoided ! [22135]

the Get-SharePointInstall function takes a long time to process because it is using the wim (or cim) win32_products class. According to mister google this class should be avoided.
Explanation here:
https://sdmsoftware.com/group-policy-blog/wmi/why-win32_product-is-bad-news/

_When you query this class, the way the provider works is that it actually performs a Windows Installer “reconfiguration” on every MSI package on the system as its performing the query_

and here:

http://gregramsey.net/2012/02/20/win32_product-is-evil/
_even though you called a basic query of the Win32_Product class, you actually performed a consistency check of each installation._

in my case I replaced this line
if (Get-CimInstance -ClassName Win32_Product -Filter "Name like 'Microsoft SharePoint Server%'")

with this:

if(Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* ) | where-Object {$_.DisplayName -like "Microsoft SharePoint Server*"}
Comments: ** Comment from web user: SpRambler **

additional note:
for a remote install this is being run twice. once in the Start-RemoteInstaller function for a cosmetic 'logging' effect as it has no impact on whether to run or not the installation on the remote server. and then it is run when the install script is run on the remote computer. this slows the installation twice.
also not that the return value of the invoke-command is empty (in my case) when the logging line ends up saying '- SharePoint 2013 binaries are installed on' with an empty space after are'.
I changed this check as follows to have true or false return value from the invoke-command

$spInstalledOnRemote = Invoke-Command -ScriptBlock {
$IsInstalled = (Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | where-Object {$_.DisplayName -like 'Microsoft SharePoint Server*'})
if ([string]::IsNullOrEmpty($Installed))
{
return $false
}
else
{
return $true
}
} -Session $session


Viewing all articles
Browse latest Browse all 2279


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>