• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/25

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

25 Cards in this Set

  • Front
  • Back

What is the fix for "The script is not digitally signed. The script will not execute on the system."

Set-ExecutionPolicy Unrestricted

What is the command to tell what PowerShell version is use?

$PSVersionTable

How to start the PowerShell ISE from command line?

PowerShell_ISE.exe

How do you enable PS Remoting for a system?

Enable-PSRemoting

How do you search the C drive for a file called test.txt?

Get-ChildItem c:\ test.txt -Recurse -Force -ErrorAction SilentlyContinue | Select-Object FullName,LastWriteTime

How do you search the C drive for a file called test.txt using the Get-ChildItem alias?

gci c:\ test.txt -r -fo -ea silentlycontinue | select fullname,lastwritetime

How can you search for a file on a remote system and write the contents out to CSV?

gci \\DC1\c$\ notepad.exe -r -fo -ea silentlycontinue | Select FullName,LastWriteTime | Export-CSV ListFileInfo-DC1.csv


What are the commands to start and stop a VM on Hyper-V?

Start-VM –Name ComputerName
Stop-VM –Name ComputerName

How do you turn off a hung VM in Hyper-V?

Stop-VM –Name ComputerName –TurnOff

How can you get a list of stopped services quickly?

Get-Service | where {$_.status -eq "Stopped" } | Out-GridView

How do you run a PowerShell command (e.g. kill process) on a remote machine?

Invoke-Command -computername machineName {Stop-Process -processname "ProcessName"}

How do you run a PowerShell command (e.g. gpupdate & restart) on a remote machine?

Invoke-Command -computername DC1 {gpupdate /force}



Invoke-Command -computername DC1 {shutdown /r /f /t 5}

How do you run a PowerShell command (e.g. gpupdate & restart) on a multiple remote machines?

Invoke-Command (Get-Content C:\Temp\ServerList.txt) {gpupdate /force}

How can I use Windows PowerShell to compare the contents of two files?

Compare-Object -ReferenceObject (Get-Content .\diskcapacity.csv) -DifferenceObject (Get-Content .\diskcapacity2.csv)

How do you grab a string that you are interested from a bunch of info?

# Use .Property, e.g.


$treg = Get-ItemProperty -path hkcu:\software\Citrix\Dazzle\ -name FirstRunInstalledDate
$treg.FirstRunInstalledDate

Read a registry value using the PS method

Get-ItemProperty -path hkcu:\software\something\ -name SomeStringName

Set a registry value using the PS method

Set-ItemProperty -path hkcu:\software\something\ -name SomeStringName -value SomeValue

Set a registry value - using the REG ADD add method

Invoke-Command {reg add HKCU\software\something /v TestString1 /t REG_SZ /d TestData /f}

What symbol is an alias for the Foreach-Object cmdlet?

Note % is an alias for the Foreach-Object cmdlet
"s1","s2","dc1" | % { Test-WSMan $_ }

What two symbols are used to represent objects?

In the example below, the "$_" symbol represents each object that is passed to the Where-Object cmdlet.
Get-Service | Where-Object {$_.Status -eq "Stopped"}

What is the difference between a Script block and a Comparison statement?

Script block:
Get-Process | Where-Object {$_.PriorityClass -eq "Normal"}
Comparison statement:
Get-Process | Where-Object -Property PriorityClass -eq -Value "Normal"

What is the difference between Select-Object & Where-Object?

Select-Object is used to choose the Properties (or columns) you want to see.
Where-Object removes, or filters, Objects out of the pipeline based on some criteria you specify.

What purpose does the Where-Object cmdlet serve?

The Where-Object cmdlet selects objects that have particular property values from the collection of objects that are passed to it.
e.g. select files that were created after a certain date.

What purpose does the Select-Object cmdlet serve?

The Select-Object cmdlet selects specified properties of an object or set of objects. It can also select unique objects, a specified number of objects, or objects in a specified position in an array.

How can you reveal hidden properties?

Get-Hotfix | Format-List * -force