Here are some PowerShell commands we can to use to perform our day to day operations as Windows System Administrators:
- Disable Server Manager from running at logon** :
- Enable Server Manager from running at logon**:
Invoke-Expression 'REG ADD HKLM\SOFTWARE\MICROSOFT\SERVERMANAGER\ /T REG_DWORD /V DoNotOpenServerManagerAtLogon /D 0 /f'
- Read text from file and perform any operation which is inside the {}:
- Invoke a command remotely on any remote server {net user is the command below} :
- List out users who have ever logged on to a remote server ** :
Get-WmiObject -ComputerName Server1 -ClassName Win32_NetworkLoginProfile| select Name, FullName, LastLogon
- List out users who have ever logged on to a server **:
Get-WmiObject -ClassName Win32_NetworkLoginProfile| select Name, FullName, LastLogon
- Loop something to run until "n" number of times after every "nn" seconds :
1..9|foreach {Get-Date -format G ; Get-Hotfix |Group Installedon; Start-Sleep 60; Write-Host " `n"}
**The command needs to be run from an elevated PowerShell console (Start PowerShell as Admin).
--------Stay tuned for more commands:
--------Stay tuned for more commands: