Install Exchange 2016 Prerequisites v1.19

** UPDATED --> 07/27/2019 **1.19 - Bug fixes1.18 - Changed to .NET 4.8 only. Removed .NET 4.7.x.   1.17 - Fixed issues with 1.16 and even more updates  Windows Defender is back and better.  1.16 - MORE Updates Added .NET 4.8 as an Option (Will be default by the Fall of 2019) -

 
 
 
 
 
4.3 Star
(7)
17,922 times
Add to favorites
Exchange
8/7/2020
E-mail Twitter del.icio.us Digg Facebook
  • ConfigurePagefile in v1.18 returns wrong Total RAM size
    5 Posts | Last post March 15, 2020
    • Please see updated function in 3 next posts...
      Main change is:
              $RamInMb = (Get-Ciminstance Win32_OperatingSystem | Select  @{Name = "TotalMB";Expression = {[int]($_.TotalVisibleMemorySize/1kb)}}).TotalMB
              #$RamInMb = (Get-CIMInstance -computername $Server -Classname win32_physicalmemory -ErrorAction Stop | measure-object -property capacity -sum).sum/1MB
    • I just checked your code that you posted and unfortunately I am consistently getting accurate results with my code and yours is off by 1 MB for my lab servers.  On my laptop, the difference was greater.  I do appreciate the feedback, but I will not be making any code changes at this time.
    • Tested on an Azure VM with 8GB RAM. Your code showing 5GB :(
    • I have a physical laptop that is accurate.  I just tested the RAM code on a VM with 4, 8 and 16 GB of RAM and they all come back accurate.  I will get a 32 GB server up a little later.  Are your test machines physical or virtual? If physical, what brand (out of curiosity) and if virtual, what hypervisor are you using (VMWare or Hyper-V or other?).  Curious to know what is causing the inaccuracies.
    • Just noticed you said you ran this on an Azure VM.  Interesting.  This script was never written to handle Azure as the entire population of Exchange servers at one time was only either physical or hypervisor local.  Let me fire up an Azure VM to see what I can do.  Thanks.
  • #Bug fix in output if RAM is greater that 32GB
    1 Posts | Last post March 13, 2020
    • #tested on a VM with 128GB RAM
      #If ($RAMDifference -gt 0 ) {
      If ($RAMDifference -gt 0 -and $ExchangeRAM -lt 32778 ) {
  • Updated Function ConfigurePagefile #continue
    1 Posts | Last post March 12, 2020
    •         If ($stop -ne $true) 
              {
                  $pagefile = Get-CimInstance win32_PageFileSetting -Property * | select-object Name,initialsize,maximumsize
                  $name = $pagefile.name;
                  $max  = $pagefile.maximumsize;
                  $min  = $pagefile.initialsize
                  Write-Host " "
                  Write-Host "This server's pagefile, located at " -ForegroundColor white -NoNewLine
                  Write-Host "$name" -ForegroundColor Green -NoNewLine
                  Write-Host ", is now configured for an initial size of: " -ForegroundColor white -NoNewLine
                  Write-Host "$min MB " -ForegroundColor Green -NoNewLine
                  Write-Host "and a maximum size of: " -ForegroundColor white -NoNewLine
                  Write-Host "$max MB." -ForegroundColor Green
                  Write-Host " "
              } 
              Else 
              {
                  Write-Host "The PageFile cannot be configuRed at this time." -ForegroundColor Red
              }
          } 
          Else 
          {
              Write-Host "The PageFile cannot be configuRed at this time." -ForegroundColor Red
          }
      
      } # End of ConfigurePagefile Function
  • Updated Function ConfigurePagefile #continue
    1 Posts | Last post March 12, 2020
    •     # Remove Existing PageFile with CIM if WMI fails
          Write-Host "Removing Existing PageFile with CIM." -ForegroundColor Yellow
          Try 
          {
              Set-CimInstance -Query “Select * from win32_computersystem” -Property @{automaticmanagedpagefile=”False”}
          } 
          Catch 
          {
              Write-Host "Cannot remove the existing pagefile with CIM." -ForegroundColor Red
              $WMIQuery = $True
          } 
      
          # Remove PageFile with WMI 
          If ($WMIQuery)	
          {
              Write-Host "Removing Existing PageFile with WMI if CIM fails." -ForegroundColor Yellow
              Try 
              {
                  $CurrentPageFile = Get-WmiObject -Class Win32_PageFileSetting
                  $name = $CurrentPageFile.Name
                  $CurrentPageFile.delete()
          	} 
              Catch 
              {
          	    Write-Host "The server $server cannot be reached via WMI." -ForegroundColor Red
                  $Stop = $True
          	}
          }
          
          # Reset WMIQuery
          $WMIQuery = $False
      
          If ($stop -ne $true) 
          {
              # Configure PageFile
              Try 
              {
                  Set-CimInstance -Query “Select * from win32_PageFileSetting” -Property @{InitialSize=$ExchangeRAM;MaximumSize=$ExchangeRAM}
              } 
              Catch 
              {
                  Write-Host "Cannot configure the PageFile correctly with CIM." -ForegroundColor Red
                  $WMIQuery = $True
              }
              
              If ($WMIQuery) 
              {
      		    Try 
                  {
                      Set-WMIInstance -computername $server -class win32_PageFileSetting -arguments @{name ="$name";InitialSize=$ExchangeRAM;MaximumSize=$ExchangeRAM}
      		    } 
                  Catch 
                  {
      			    Write-Host "Cannot configure the PageFile correctly with WMI." -ForegroundColor Red
                      $stop = $true
      		    }
              }
      
      
      #continue in the next post
                 
  • Updated Function ConfigurePagefile
    1 Posts | Last post March 12, 2020
    • Function ConfigurePagefile 
      {
          $Stop = $False
          $WMIQuery = $False
          $Server = $env:COMPUTERNAME
          
          # Get RAM and set ideal PageFileSize - CIM Method
          Try 
          {
              $RamInMb = (Get-Ciminstance Win32_OperatingSystem | Select  @{Name = "TotalMB";Expression = {[int]($_.TotalVisibleMemorySize/1kb)}}).TotalMB
              #$RamInMb = (Get-CIMInstance -computername $Server -Classname win32_physicalmemory -ErrorAction Stop | measure-object -property capacity -sum).sum/1MB
              Write-Host
              Write-Host "The amount of RAM in the server, acuired with CIM: " -ForegroundColor white -NoNewline
              Write-Host "$RamInMb MB" -ForegroundColor Green
              Write-Host
              $ExchangeRAM = $RAMinMb + 10
              # Set maximum pagefile size to 32 GB + 10 MB
              If ($ExchangeRAM -gt 32778) {$ExchangeRAM = 32778}
          } 
          Catch 
          {
              Write-Host "Cannot acquire the amount of RAM in the server with CIM." -ForegroundColor Red
              $WMIQuery = $True
          }
      
      
      # Get RAM and set ideal PageFileSize - WMI Method
          If ($WMIQuery)	
          {
          	Try 
              {
                  $RamInMb = (Get-WmiObject -ComputerName $server -Classname win32_physicalmemory -ErrorAction Stop | measure-object -property capacity -sum).sum/1MB
                  Write-Host
                  Write-Host "The amount of RAM in the server, acuired with WMI: " -ForegroundColor white -NoNewline
                  Write-Host "$RamInMb MB" -ForegroundColor Green
                  Write-Host
                  $ExchangeRAM = $RAMinMb + 10
          
                  # Set maximum pagefile size to 32 GB + 10 MB
                  If ($ExchangeRAM -gt 32778) {$ExchangeRAM = 32778}
          	} 
              Catch 
              {
          		Write-Host "Cannot acquire the amount of RAM in the server with WMI queries." -ForegroundColor Red
          		$Stop = $True
          	}
          }   
      
      #continue in the next post
  • Option 21 duplicated in v 1.16
    2 Posts | Last post July 28, 2019
    • Hi, and thanks for great script! You added line 21 (One-off .Net 4.8) but the rest of numbering didn't change, causing duplicate entry with existing line 21 (One off Win Features). Selecting 21 installs .Net 4.8. 
    • Take a look at the new version (1.17).  I just added Windows Defender exclusions into it as well.  Thanks for the comment.
  • Download doesn't work
    4 Posts | Last post October 15, 2016
    • Hi,
      
      when trying to download UCMA, I'll get the following error:
      
      Start-BitsTransfer: HTTP status 403: The client does not have sufficient access rights to the requested server object.
      In C:\Users\Administrator\Desktop\Set-Exchange2016Prerequisites-1.8.ps1:95 Char:17
      
      What to do?
      Thanks.
    • There are a couple of possibilities here.  Could be that you don't have permissions to download the file or don't have permission to save the file to the correct location (possibly folder creation)?  Try running the PowerShell window with Administrator rights.  If that fails, make sure your server can access the Internet without a proxy connection, if a proxy connection is required, some modification of the script might be necessary.
    • Turns out, that it fails because of proxy usage. Would be nice if you can add another other to specify proxy settings.
    • ihka, I will see what I can do to add some sort of proxy detection to the script. Look for it in version 1.10.
  • Powermanagement settings
    2 Posts | Last post October 14, 2016
    • Hi 
      
      For the NIC PnPCapabilities setting for Windows 2012, for us, that value has to be Hex 118 to disable power management. 24 does not seem to make any difference. 
      
      I've looked at this article, https://support.microsoft.com/en-gb/kb/2740020 and can see your logic but at least on our virtual servers with VCA's default NIC type of Intel(R) 82574L Gigabit Network Connection, that's the value that works.... 
      
      Thanks
      
    • I believe 118 will do essentially the same thing, but Microsoft recommends 24.  This setting has been tested on 2008, 2012, 2012 R2 and now 2016.  I use this script in multiple lab environments and all servers have Power Management disabled.  Assume the server was rebooted after the setting was changed?  
  • typo in Install-DotNET461
    2 Posts | Last post July 12, 2016
    • There is a little typo in the script:
      IInstall-DotNET461 : The term 'IInstall-DotNET461' is not recognized as the name of a cmdlet,
      Change "IInstall-DotNET461" to "Install-DotNET461" and the sun is shining. 
    • Thanks for noticing that.  Fixed a couple of other minor typos as well.