Understanding how to interpret (or trace) an existing PowerShell script is vital when searching for PowerShell scripts on the Internet that suit a particular administrative need. Trace the PowerScript script shown in below and write a short memo describing what it will do after being executed: $list = get-childitem | sort-object foreach (objItem in $list) { if ($objitem.attributes - contains "directory") { $fgc="cyan" } elseif ($objItem.Extension -eq ".ps1") { $fgc="blue" } elseif ($objItem.Extension -eq ".exe") { $fgc="green" } elseif ($objItem.Extension -eq ".zip") { $fgc="red" } elseif ($objItem.Extension -eq ".rar") { $fgc="red" } else { $fgc="yellow" } write-host $objItem.name, $objItem.Length, objItem.LastWriteTime -foregroundcolor $fgc
Understanding how to interpret (or trace) an existing PowerShell script is vital when searching for PowerShell scripts on the Internet that suit a particular administrative need. Trace the PowerScript script shown in below and write a short memo describing what it will do after being executed:
$list = get-childitem | sort-object
foreach (objItem in $list) {
if ($objitem.attributes - contains "directory") {
$fgc="cyan" }
elseif ($objItem.Extension -eq ".ps1") {
$fgc="blue" }
elseif ($objItem.Extension -eq ".exe") {
$fgc="green" }
elseif ($objItem.Extension -eq ".zip") {
$fgc="red" }
elseif ($objItem.Extension -eq ".rar") {
$fgc="red" }
else { $fgc="yellow" }
write-host $objItem.name, $objItem.Length, objItem.LastWriteTime
-foregroundcolor $fgc
Trending now
This is a popular solution!
Step by step
Solved in 2 steps