Tech
Published on June 26th, 2014 | by Kieran
0Useful PowerShell Commands
Here are some useful PowerShell scripts that I have been using of late. They are all general scripts for simple admin tasks like renaming machines, disabling firewall, adding users to local groups.
Disable User Account Control
1 |
New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force |
Disable IE Enhanced Security
1 2 3 4 5 6 7 8 9 |
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 |
Turn Off Firewall
1 |
netsh advfirewall set allprofiles state off |
Add User To Local Admin Group
1 |
net localgroup administrators username /add |
Rename Computer
1 |
Rename-Computer -NewName NewServerName -Restart |