Counting Specific words in a Text/log file Counting the depth of nested directories Counting Users in AD security groups and getting different results with -recursive coverting CURL command to powershell CPU Percentage cpu utilization command in powershell Create 100,000 files Create a Multiline Inpu...
To create a switch parameter in a function, specify the [switch] type in the parameter definition. The following example shows the definition of a switch parameter that could be used to provide an option to output data as a byte array: PowerShell Copy param([switch]$AsByteArra...
size in KiloBytes of each FileInfo# object you pass in. Use the pipeline variable to divide each file's length by# 1 KiloBytes$size= @{Label="Size(KB)";Expression={$_.Length/1KB}}# Create an additional calculated property with the number of Days since the# file was last accessed. ...
all of the standard*-Jobcmdlets can be used to manage the job. Variables (ignoring process-specific variables) used in the pipeline are automatically copied to the job soCopy-Item $foo $bar &just works. The job is also run in the current directory instead of the user's home directory. ...
There are great tools and resources online to accomplish most any task in PowerShell, sometimes however, there is a need to script together a util for a specific purpose or to bridge an ontological gap. This is a collection of PowerShell utilities I put together either for fun or because ...
Use the ESC key instead of theCancelbutton. In order to do this we first set theKeyPreviewproperty to true ($True); that tells the form to intercept specific keystrokes rather than allow those keystrokes to be used by the controls on the form. What keystrokes do we want to capture? You...
The $ErrorActionPreference variable takes one of the ActionPreference enumeration values: SilentlyContinue, Stop, Continue, Inquire, Ignore, Suspend, or Break. You can use a cmdlet's ErrorAction common parameter to override the preference for a specific command. The valid values are as follow...
Incidentally, the Set-Item method has a corollary method namedGet_Item; this method enables us to retrieve the value associated with a specific item in the hash table. Not sure which city is the capital of Oregon? Then run this command and find out for yourself: ...
Set-BitmapSize Sets the size of the specified bitmap. Byte Format-Byte Displays numbers in multiples of byte units. BZip2 Write-BZip2 Create BZIP2 format archive files from pipeline or parameter input. PscxClipboard Get-PscxClipboard Gets data from the clipboard. ...
size in KiloBytes of each FileInfo# object you pass in. Use the pipeline variable to divide each file's length by# 1 KiloBytes$size= @{Label="Size(KB)";Expression={$_.Length/1KB}}# Create an additional calculated property with the number of Days since the# file was last accessed. ...