Spot an error? Know how to make this page better? I appreciate pull requests.
Powershell
Quick notes on common powershell commands
Reading a file in realtime, just like tail -f
with linux
Get-Content -Path \\Path\To\File -Wait
Copy groups from one user to another
Get-Aduser -Identity UserToCopyGroupsFrom -Properties MemberOf |
Select -ExpandProperty MemberOf
Add-ADGroupMember -Members UseBeingAddedToGroups -PassThru |
Select SamAccountName
Enable remote desktop (assuming WinRM is enabled)
Invoke-Command -ComputerName PC -Credential (Get-Credential AdminUser) -ScriptBlock {
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1
}