PowerShell commands every Windows admin should know

· RPC Server is unavailable
You need to change the Firewall rules on both machines (NOT only the Hyper-V Server)
o NetSh advfirewall firewall set rule group=”Remote Volume Management” new enable=yes
· Opening Network Connection
o NCPA.CPL
· Managing Features ( Add & Remove )
o Show Features List: Get-WindowsFeature
o Add/Install Feature: Install-WindowsFeature (Feature name)
o Install many features: Install-WindowsFeature (Feature name),(2nd Feature name)
o Install All feature tools: Get-WindowsFeature (Feature name)* |Add-WindowsFeature
o Install Feature Remotely: Install-WindowsFeature (Feature name) –ComputerName –Credential
o Install Feature Using Path: Install-WindowsFeature (Feature Name) (Source)
o Install Feature Offline using VHD : Install-WindowsFeature (Feature Name) –VHD (Storage Path)
o Un-Install Feature: Un-install-WindowsFeature (Feature Name) –Remove
· Exporting & Deleting & Importing Features And Migrate to New One
o Exporting: Export- SmigServerSetting –FeatureID DHCP –Group IPConfig –Path (Storage Path) –Verbose
o Deleting : NetSh DHCP delete server (FQDN) (IP)
o Importing: Import –SmigServerSetting FeatureID DHCP –Group IPConfig –SourcePhysicalAddress (MAC)
-TargetPhysicalAddress (MAC) –Path (Storage Path) –Verbose
o Start Service: Start-Service DHCPServer
o Authorize: NetSh DHCP Server (FQDN) (IP)
· Show & Change Machine IP Address
o Show Config: NetSh Int IPv4 Show Config
o Show Route: NetSh Int IPv4 Show Route
o Change Config: NetSh Int IPv4 Set Address Name= (Int No.) Static (IP) (MASK) (GATEWAY)
o Add DNS: NetSh Int IPv4 add DNSServer Name= (Int No.) Address=(IP) Index=(Primary =1 Secondary =2)
· Remote Management Using PowerShell
o Manage Using Pop-up Credential : Enter-PSSession –ComputerName DC1 –Credential $Cred
o Manage Using Not Listed in Trust ( Not Joined ) :
o To Show > WinRM get WinRM/Config/Client
o To ADD : Set-Item WSman:\LocalHost\TrustedHosts (PC Name) – Concatenate –Force
· Show All Modules for Hyper -V & Get Help
o Show : GCM -Module Hyper-V
o Try Help: Help (Module Name)
o Try Full Help: Help (Module Name) –Full
o Get-Command *Part of Command*
· Install Active Directory with All Features
o Install-WindowsFeature –Name AD-Domain-Services –IncludeManagementTools
· IFM : Install Domain Controller From Media Using PowerShell
Exporting
o NTDSUtill
o IFM >> For Help?
o Create Sysvol Full E:\IFM
Importing
o Install-ADDsDomainController –InstallationMediaPath E:\IFM –Credential (Get-Credential DS\Admin)
· Resolve DNS Srv Issues
o DCDiag /Fix
o OR : Net Stop Net Logon & Net Start Net Logon
o Or : Replicate From Other DC using AD Service
· Adding Machine to Event Log Reader
o Net LocalGroup “Event Log Readers” (PC NAME)$ /add

The Rubik’s Cube makes a perfect gift for any occasion. Learn how to solve the cube on Ruwix.

Share:

administrator

Microsoft MVP | Speaker | Azure Service Delivery Lead at Bespin Global MEA, helping customers build successful Azure practices. Talks about #AzureCloud and #AI