Powershell

From Max's Wiki
Revision as of 03:04, 25 June 2018 by Max (talk | contribs)
Jump to navigation Jump to search


Run Powershell Remotely

How to Run PowerShell Commands on Remote Computers

View Installed Updates Remotely

Get-Hotfix -computername SEA-SRV-01 | Select HotfixID, Description, InstalledOn | Sort-Object InstalledOn

Uninstall Updates:

  • psexec @target+workstations.txt -d -s
  • wusa.exe /uninstall /kb:000000 /quiet /norestart

View Mapped Drives Remotely

Get-WmiObject Win32_MappedLogicalDisk -computer <computername> | select name, providername

Other

Powershell Commands for Hyper-V 2012: http://marckean.wordpress.com/2012/09/26/windows-server-2012-hyper-v-server-command-line-configuration-2/

COM+ Network Access (DCOM-In) mikefrobbins.com/2013/02/28/use-powershell-to-remotely-enable-firewall-exceptions-on-windows-server-2012/


Remote into remote server using PowerShell with the following command:

PS C:\> Enter-PSSession -ComputerName dc1 [dc1]: PS C:\Users\Administrator\Documents> sl c:\


Show BIOS Information: gwmi win32_bios

Run: Invoke-Command -ComputerName dc1, dc2 { Set-NetFirewallRule -DisplayGroup 'Remote Event Log Management' -Enabled True -PassThru | select DisplayName, Enabled } -Credential (Get-Credential)