PowerShell Flashcards
What is the command to change computer name?
Rename-Computer
What is the command to restart the computer?
Restart-Computer
What is the command to get a list of windows features?
Get-WindowsFeature
What is the command to install and uninstall windows feature?
Install-WindowsFeature
Uninstall-WindowsFeature
What is the command to remove a feature and its payload path?
Uninstall-WindowsFeature -Remove
What is the command to remove all features and payloads not installed?
Get-WindowsFeature | Where-Object {$._Installed -eq $false} | Uninstall-WindowsFeature -Remove
What is the command to configure IP address?
New-NetIPAddress -InterfaceIndex/Alias (-AddressFamily) -IPAddress -DefaultGateway -PrefixLength
What is the command to configure DNS?
Set-DNSClientServerAddress -InterfaceIndex/Alias -ServerAddresses
What is the command to get a list on IP interfaces?
Get-NetIPInterface
What is the command to add a computer to a domain?
Add-Computer -DomainName
What is the command to get a list of computers connected to a domain?
Get-ADComputer -Filter *
What is the command to disable the firewall completely?
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
What is the command to create a firewall rule?
New-NetFirewallRule -Name -Direction Inbound/Outbound -Action Block/Allow -Protocol
What is the command to add the GUI interface?
Install-WindowsFeature -Server-Gui-Mgmt-Infra, Server-Gui-Shell -Source:wim:D:\sources\install.wim:1/2/3/4
What is the command to see cmdlets within load balancing fail-over?
Get-Command -Module Netlbfo
What is the command to create a new nic team?
New-NetlbfoTeam -Name -TeamMembers -TeamingMode -LoadBalancingAlgorithm
What is the command to see cmdlets within service?
Get-Command -Noun Service
What is the command to copy an item and paste it?
Copy-Item -Path -Destination
What is the command to copy an item and make it not read-only?
Copy-Item -Path -Destination -PassThru | Set-ItemProperty -Name IsReadOnly -Value $False
What is the command to create a new folder?
New-Item -Type Directory -Name -Path
What is the command to see images (index) within a wim file?
Get-WindowsImage -ImagePath
What is the command to mount a wim image?
Mount-WindowsImage -ImagePath -Path -Index
What is the command to unmount a wim image?
Dismount-WindowsImage -Path
How do you create a configurtion?
In a ps1 script: Configuration { Node "COMPUTER" { WindowsFeature { Name = '' Ensure = 'Present' } } }
How do you deploy a script?
# Generate the .MOF file ConfigurationName -OutputPath c:\
# Push the .MOF to computer Start-DscConfiguration -Path c:\ -Wait -Verbose
What is the command to see cmdlets within desired state configuration?
Get-DscResource
What are the main components of a PowerShell DSC configuration script?
Configuration
Node
Resource