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
How can you retrieve a list of environment variables? |
gci env: OR Get-ChildItem Env: |
|
How can you append a string to a variable? |
+= |
|
How can we determine the unique items in a collection? |
Get-Unique |
|
How to run an executable with arguments - method 1 |
$exe = "X:\setup.exe" |
|
Which command enables you to display data in the Windows PowerShell window and to save that same data to a text file, all with a single command? |
Get-Process | Tee-Object -file D:\TEMP_Work\test.txt |
|
How can you run a PS script located on a network share on the local machine you are logged into? |
\\server\share\script.ps1 |
|
How can you pause a script in PowerShell? |
How can you pause a script in PowerShell? |
|
What are the implications of upgrading a PowerShell version from the default to a newer version? |
It might break apps - certain apps such as Exchange/SCCM require certain versions of PS and the WMF. |
|
How can you run the erase the contents of a file without deleting the file itself? |
Clear-Content c:\scripts\test.txt |
|
How can you get a history of previously run items on the PS Command Line? |
Get-History |
|
How can you run a previously executed command? |
Invoke-History 3 |
|
When using Write-Host, how can you mix colours of text on the same line? |
Write-Host "Data for " -nonewline; Write-Host "atl-ws-01" -foregroundcolor red -backgroundcolor yellow -nonewline; Write-Host " retrieved May 12, 2006" |
|
What is the CMDLET to write a warning message? |
Write-Warning "The folder C:\Scripts2 does not exist." |
|
How can you determine whether or not a specific string value exists in a text file? e.g. Check a log file for the string "error". |
Get-Content c:\Temp\ErrorLog.txt | Select-String "Failed" -caseinsensitive |
|
How can you exit a function immediately? |
Use the return statement. |
|
How can you determine the number of days between two dates? |
New-TimeSpan cmdlet |
|
How can you work around a Citrix XenApp server GPO Lockdown policy that denies CMD prompt access? |
powershell.exe |
|
How can you get info about installed modules? |
Get-Module -listavailable |
|
How to run an executable with arguments - method 2 |
$ChocoStart = 'choco' |
|
How do you format a function? |
function Disable-Firewall { netsh advfirewall set allprofiles state off } |
|
How can you capture user input? |
Use Read-Host |
|
How can you pass Command Line Arguments to script with spaces? |
myscript.ps1 server1 benp |
|
What are four loop options? |
Do While loop, Do Until loop |
|
What is the difference between Do While and Do Until loops? |
Do While loop - repeat a set of commands WHILE a condition is met |
|
What is the difference between For and ForEach loops? |
For loop - repeat the same steps a specific number of times |