# added write-output to match write-host as there is a limiation on either outputting to screen or outputting to file but not both param($fileoutpath) $thisdate = Get-Date $computername = $env:computername # Set a default path for output file to root of c drive If ($fileoutpath -eq $null) {$fileoutpath = "c:\"} # Create an empty file object Out-file -filepath $fileoutpath\EVBestPracticeRegKeys_$computername.txt #size the script results window function windowSize { $pshost = get-host $pswindow = $pshost.ui.rawui $newsize = $pswindow.buffersize $newsize.width = 125 $newsize.height = 3000 $pswindow.buffersize = $newsize $newsize = $pswindow.windowsize $newsize.width = 100 $newsize.height = 55 $pswindow.windowsize = $newsize Clear-Host } #format the output function formatLine($strIn) { $num = $strIn.Length for($i=1; $i -le $num; $i++) {$formatLine+= "="} Write-ho null " " Write-ho White "$strIn " Write-ho White $formatLine } #check for each reg entry (inc. Wow6432Node entries) Function regcheck { param($path, $key, $val) If ($path -Match "SOFTWARE\\KVS") { $x64RootPath = "HKLM:\SOFTWARE\Wow6432Node" If (test-path $x64RootPath) { $x64path = $path.Replace("SOFTWARE\KVS", "SOFTWARE\Wow6432Node\KVS") $path = $x64path } } formatLine ($key) Write-Host "$path\$key" If (test-path $path) { $psc = get-itemproperty -path $path If ($psc) { write-ho null "[Root Path Exists] " If ($psc.$key) { write-ho null "[Reg Value Exists] " If ($psc.$key -eq $val) { write-ho Green "[PASSED: Best Practice] " } Else { write-ho Red "[FAILED: Best Practice Value is wrong] " } } Else { If ($psc.$key -eq $NULL) {write-ho Red "[FAILED: $key Value does not exist] "} Else {write-ho Red "[FAILED: $key exists with 0 value] "} } } } Else { write-ho Red "[FAILED: Reg Path does not Exist] " } } #check the boot.ini file for 3GB and PAE function bootini { $fileContents = Get-Content -path "$env:systemDrive\boot.ini" Write-host -ForegroundColor White formatline "Check boot.ini for /3GB and /PAE (line-by-line)" Switch -regex ($fileContents) { "/3GB" {Write-ho Red "[/3GB CHECK FAILED]"} "/PAE" {Write-ho Red "[/PAE CHECK FAILED]"} default {Write-ho Green "[PASSED]"} } Write-ho $null " " } # End of function # Output to file function fileout { param($output) $output | Out-file -filepath $fileoutpath\EVBestPracticeRegKeys_$computername.txt -append } # write to screen function write-ho { param($colour, $text) Switch -regex ($colour) { "null" {write-host $text} "Red" {write-host -ForegroundColor Red $text} "White" {write-host -ForegroundColor White $text} "Green" {write-host -ForegroundColor Green $text} } fileout $text } windowsize Set-ExecutionPolicy Remotesigned write-ho null "Enterprise Vault Best Practice Registry Keys and Boot.ini Settings" Write-ho White "See http://support.veritas.com/docs/326236 for more information related to these settings." write-ho null " " $RunAgainst = "Run against : $computername on $thisdate" write-ho null $RunAgainst bootini formatline "Enterprise Vault 8.0 Specific Registry Settings" Write-ho White "The following settings can now be set automatically in EV8 but are applicable in all" Write-ho White "versions of the product:" regcheck "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" "PagedPoolSize" "-1" regcheck "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" "PoolUsageMaximum" "60" regcheck "HKLM:\SOFTWARE\Microsoft\MSMQ\Parameters" "KernelMemThreshold" "95" regcheck "HKLM:\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" "DisableStrictNameChecking" "1" regcheck "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" "DisableLoopbackCheck" "1" regcheck "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "MaxUserPort" "65534" regcheck "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" "TcpTimedWaitDelay" "120" regcheck "HKLM:\SYSTEM\CurrentControlSet\Services\MRxSmb\Parameters" "OplocksDisabled" "1" Write-ho null " " Write-ho White "The following settings are general best practise settings for all versions of Enterprise Vault:" regcheck "HKLM:\SOFTWARE\KVS\Enterprise Vault\Indexing" "MaxMSMQMessageSize" "3670016" Write-ho Red "Note: Redundant as of EV2007 SP4 when this issue was fixed!" Write-ho null " " regcheck "HKLM:\SOFTWARE\KVS\Enterprise Vault\Directory\DirectoryService" "ArchiveListChunkThreshold" "1000" regcheck "HKLM:\SOFTWARE\KVS\Enterprise Vault\Indexing" "AVSMaxLoc" "500000000" Write-ho Red "Note: This setting is no longer recommended or required`n and is now defaulted to 1billion" regcheck "HKLM:\SOFTWARE\KVS\Enterprise Vault\Indexing" "SchemaType" "0" regcheck "HKLM:\SOFTWARE\KVS\Enterprise Vault\Indexing" "SearchChunkSize" "5000" Write-ho null " " Write-ho Green "[ALL CHECKS COMPLETE]" Write-ho null " "