PowerShell Constant and Read-Only Variables
PowerShell has a built-in cmdlet New-Variable to create read-only and constant variables. This command uses the parameter -Option Constant to create a constant variable. The …
PowerShell has a built-in cmdlet New-Variable to create read-only and constant variables. This command uses the parameter -Option Constant to create a constant variable. The …
The Clear-Variable cmdlet in PowerShell clear variable value, as a result, the variable value is empty or NULL. At times, it is important to clear …
Use the New-Item cmdlet in PowerShell to create an empty file. This command generates an empty file in the specified location. An empty file can …
The New-TemporaryFile cmdlet in PowerShell is used to create a temporary file easily. Creating a temp file in PowerShell is a common task when you …
Use the environment variable `$env:Temp` to get the temp folder in PowerShell. This variable returns the current user’s temp folder path. The temp folder in …
Use the Get-Module cmdlet in PowerShell to list installed modules. PSModulePath variable contains the location path of Windows PowerShell modules. A PowerShell module is a …
To convert timestamp to Date in PowerShell, use the .Net method FromFileTimeToUTC(). This method takes Int64 as the input parameter and returns the DateTime. Windows …
The file has attributes like CreationTime, LastWriteTime, Length, etc. In PowerShell to compare files by modified date or creation date, use the PowerShell operators lt …
To Compare dates in PowerShell, use the PowerShell operator lt or gt. It compares the date that is less or greater than the other date …
In PowerShell to Get-Date minus 1 day date or get yesterday’s date, use the Get-Date cmdlet. The Get-Date has AddDays() function that takes -1 day …