PowerShell Script for a WebFarm Server

on Sunday, August 5, 2012

I’m not sure where gbecerra got this script, but it is very nice. And, the reason it was posted on experts-exchange is because it was being executed in PowerShell ISE, which doesn’t support the *-Tracing commands (they are only supported from the command line on the host).

http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_26769992.html

The only slight improvement that was added to the script was implementing MS Knowledge Base issue 977754 (http://support.microsoft.com/kb/977754). For some odd reason, some of our servers had this problem.

########################## Implement KB977754 fix ##########################
# http://support.microsoft.com/kb/977754
Write-Host "Implementing KB977754 fix"

$kb977754Files = Get-Item $Env:ALLUSERSPROFILE\Microsoft\Crypto\RSA\MachineKeys\76944fb33636aeddb9590521c2e8815a_*
foreach($i in $kb977754Files) {
$acl = Get-Acl $i
$permissionSet = "NT AUTHORITY\LOCAL SERVICE",”Read”,”Allow”
$ar = New-Object  system.security.accesscontrol.filesystemaccessrule $permissionSet
$acl.SetAccessRule($ar)
Set-Acl $i $acl
}

0 comments:

Post a Comment


Creative Commons License
This site uses Alex Gorbatchev's SyntaxHighlighter, and hosted by herdingcode.com's Jon Galloway.