PowerShell Flashcards Preview

Windows Server 2012 > PowerShell > Flashcards

Flashcards in PowerShell Deck (27)
Loading flashcards...
1

What is the command to change computer name?

Rename-Computer

2

What is the command to restart the computer?

Restart-Computer

3

What is the command to get a list of windows features?

Get-WindowsFeature

4

What is the command to install and uninstall windows feature?

Install-WindowsFeature
Uninstall-WindowsFeature

5

What is the command to remove a feature and its payload path?

Uninstall-WindowsFeature -Remove

6

What is the command to remove all features and payloads not installed?

Get-WindowsFeature | Where-Object {$._Installed -eq $false} | Uninstall-WindowsFeature -Remove

7

What is the command to configure IP address?

New-NetIPAddress -InterfaceIndex/Alias (-AddressFamily) -IPAddress -DefaultGateway -PrefixLength

8

What is the command to configure DNS?

Set-DNSClientServerAddress -InterfaceIndex/Alias -ServerAddresses

9

What is the command to get a list on IP interfaces?

Get-NetIPInterface

10

What is the command to add a computer to a domain?

Add-Computer -DomainName

11

What is the command to get a list of computers connected to a domain?

Get-ADComputer -Filter *

12

What is the command to disable the firewall completely?

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

13

What is the command to create a firewall rule?

New-NetFirewallRule -Name -Direction Inbound/Outbound -Action Block/Allow -Protocol

14

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

15

What is the command to see cmdlets within load balancing fail-over?

Get-Command -Module Netlbfo

16

What is the command to create a new nic team?

New-NetlbfoTeam -Name -TeamMembers -TeamingMode -LoadBalancingAlgorithm

17

What is the command to see cmdlets within service?

Get-Command -Noun Service

18

What is the command to copy an item and paste it?

Copy-Item -Path -Destination

19

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

20

What is the command to create a new folder?

New-Item -Type Directory -Name -Path

21

What is the command to see images (index) within a wim file?

Get-WindowsImage -ImagePath

22

What is the command to mount a wim image?

Mount-WindowsImage -ImagePath -Path -Index

23

What is the command to unmount a wim image?

Dismount-WindowsImage -Path

24

How do you create a configurtion?

In a ps1 script:
Configuration {
Node "COMPUTER" {
WindowsFeature {
Name = ''
Ensure = 'Present'
}
}
}

25

How do you deploy a script?

# Generate the .MOF file
ConfigurationName -OutputPath c:\

# Push the .MOF to computer
Start-DscConfiguration -Path c:\ -Wait -Verbose

26

What is the command to see cmdlets within desired state configuration?

Get-DscResource

27

What are the main components of a PowerShell DSC configuration script?

Configuration
Node
Resource