Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Help with figuring out commands for test!

$
0
0

These are study guide questions, I would appreciate any help!!

What does the following PowerShell command do?

PS C:> ls | Where-Object { $.PSIsContainer } | ForEach-Object { (ls $ | ? { -not $_.PSIsContainer } | sort LastWriteTime)[0] }

Select one:

Finds all the files that are one subdirectory deep

Searches one subdirectory level deep and finds the least recently modified file in each subdirectory

Recursively searches for the file named "0"

Searches each subdirectory and finds the most recently modified file

Recursively searches for the newest file on the system

What does the following PowerShell command do?

PS C:> Select-String "[0-9]{10}" audit.log

Select one: Searches for the literal string "[0-9]{10}" and returns each line containing the string

Looks for and returns the first instance of the literal string "[0-9]{10}" in the file audit.log

Looks for and returns each line containing 10 consecutive digits in the file audit.log

Looks for and returns the first number that is exactly 10 digits found in the file audit.log

Looks for and returns a 0-9 followed by a 1 or 0 in the file audit.log

What does the following PowerShell command do?

PS C:> ls -r -fo | ? { $_.LastAccessTime -gt (Get-Date).AddDays(-1) } | select LastAccessTime, Name

Select one: Finds all files, excluding hidden files, accessed in the last day and outputs the last access time and filename

Finds all files, excluding hidden files, accessed in the last day and outputs the last access time and the user

Finds all files, including hidden files, accessed in the last day and outputs the last access time and filename

Finds all files, including hidden files, accessed in the last day and outputs the last access time and the user

Finds all files, including hidden files, accessed more than one day ago and outputs the last access time and filename

What does the following PowerShell command do?

PS C:> Get-Process cmd | ? { $_.StartTime -lt (Get-Date).AddHours(-1) } | Stop-Process

Select one: Kills any cmd.exe process that has been running for longer than an hour

Starts cmd.exe and stops it after one hour

Kills any cmd.exe processes that started exactly one hour ago

Kills any cmd.exe process that has started in the past hour

Starts cmd.exe after pausing for one hour

What does the following PowerShell command do?

PS C:> ls \users\ephil\Documents | % { move $.FullName -dest $.FullName.ToLower() }

Select one: Moves each file in \Users\ephil\Documents to a lower directory

Moves each file in \Users\ephil\Documents to the directory named FullNameToLower

Moves files with all lowercase characters to \Users\ephil\Documents

Finds all files containing the words user, ephil or documents and renames them to lower case

Renames each file in \Users\ephil\Documents to lower case


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>