May 2007
Beginner
320 pages
8h 23m
English
In this exercise, we will do the following:
Open the yournameCreateMultipleFolders.ps1 in Notepad or your favorite script editor. This script was created in the step-by-step exercise.
In the if … else statement, the New-Item cmdlet is used twice to create folders in the C:\Mytest directory. We want to delete these folders. To do this, we need to change the New-Item cmdlet to the Remove-Item cmdlet. The two edited script blocks are shown here:
{$intPad=0
remove-item -path c:\mytest -name $strPrefix$intPad$i -type directory}
else
{remove-item -path c:\mytest -name $strPrefix$i -type directory}The Remove-Item cmdlet does not have a name argument. Therefore, we need to remove this argument but keep the code ...
Read now
Unlock full access