Powershell renaming multiple server names
<p>I recently got the answer to get the friendly name of Windows servers, for example, Windows Server 2008 R2 Enterprise, and I wanted to remove "Windows Server", here is the code that does this correctly:</p>

<pre><code>$Build = (Get-WmiObject -Class Win32_OperatingSystem -Computername $Computer | Select-Object -ExpandProperty Caption) -replace "Microsoft Windows Server ",""
</code></pre>

<p>However,  I have discovered that Windows 2003 have a slightly different naming convention:</p>

<pre><code>Microsoft(R) Windows(R) Server 2003, Standard Edition. 
</code></pre>

<p>So I want the script to remove "Microsoft(R) Windows(R) " if this is the case. I tried adding <code>-or -replace "Microsoft(R) Windows(R) Server ",""</code> but this doesn't seem to work.</p>