Local Server Configuration with PowerShell Script.
Write-Host "Attempting to disable IE Enhanced Security Configuration (ESC) " -ForegroundColor Green
function Disable-IEESC
{
$AdminKey = “HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}”
$UserKey = “HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}”
Set-ItemProperty -Path $AdminKey -Name “IsInstalled” -Value 0
Set-ItemProperty -Path $UserKey -Name “IsInstalled” -Value 0
Stop-Process -Name Explorer
}
Disable-IEESC
Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -ForegroundColor Green
Write-Host "Attempting to Enable Remote Desktop " -ForegroundColor Green
(Get-WmiObject Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) | Out-Null
(Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\TerminalServices -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0) | Out-Null
Get-NetFirewallRule -DisplayName "Remote Desktop*" | Set-NetFirewallRule -enabled true
Write-Host "Remote Desktop Enabled" -ForegroundColor Green
Write-Host "Attempting to Set Time Zone to Bangladesh Standard Time" -ForegroundColor Green
& "$env:windir\system32\tzutil.exe" /s "Bangladesh Standard Time"
Write-Host "Set Time Zone to Bangladesh Standard Time Successfull" -ForegroundColor Green
Write-Host "Attempting to Disable Firewall" -ForegroundColor Green
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
Write-Host "Disable Firewall Successfull" -ForegroundColor Green
function Disable-IEESC
{
$AdminKey = “HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}”
$UserKey = “HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}”
Set-ItemProperty -Path $AdminKey -Name “IsInstalled” -Value 0
Set-ItemProperty -Path $UserKey -Name “IsInstalled” -Value 0
Stop-Process -Name Explorer
}
Disable-IEESC
Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -ForegroundColor Green
Write-Host "Attempting to Enable Remote Desktop " -ForegroundColor Green
(Get-WmiObject Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) | Out-Null
(Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\TerminalServices -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0) | Out-Null
Get-NetFirewallRule -DisplayName "Remote Desktop*" | Set-NetFirewallRule -enabled true
Write-Host "Remote Desktop Enabled" -ForegroundColor Green
Write-Host "Attempting to Set Time Zone to Bangladesh Standard Time" -ForegroundColor Green
& "$env:windir\system32\tzutil.exe" /s "Bangladesh Standard Time"
Write-Host "Set Time Zone to Bangladesh Standard Time Successfull" -ForegroundColor Green
Write-Host "Attempting to Disable Firewall" -ForegroundColor Green
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
Write-Host "Disable Firewall Successfull" -ForegroundColor Green
1. Copy the following code on notepad.
2. Save it as .ps1 formate. (P S One)
3. Run the file "Run with PowerShell" on your Windows Server.
It will automatically configure all the necessary settings of Local Server.
Comments
Post a Comment