You are assigning 14
to $TimeDifference
. Instead you wan’t to compare the Days
property using -le
:
if ($TimeDifference.Days -le 14)
{
Write-Host "test"
}
More Related Contents:
- How do I pass multiple parameters into a function in PowerShell?
- PowerShell and the -contains operator
- how do I pass a range of values on the command line – passing an expression as an argument
- How do I do the bash equivalent of $PROGPATH/program in Powershell?
- PowerShell’s parsing modes: argument (command) mode vs. expression mode
- ‘kubectl patch’ works on Linux Bash but not in Windows Powershell ISE
- What does $($variableName) mean in expandable strings in PowerShell?
- Powershell color formatting with format operator
- Convert a batch-file command with complex arguments to PowerShell
- Create an incrementing variable from 2 variables in PowerShell
- PowerShell string interpolation syntax
- Why do integers in PowerShell compare by digits?
- Is there a powershell pattern for if($?) { }
- Powershell script to delete 15 days old .txt files [duplicate]
- Which equals operator (== vs ===) should be used in JavaScript comparisons?
- What is Ruby’s double-colon `::`?
- How to run an EXE file in PowerShell with parameters with spaces and quotes
- Fastest Way to get a uniquely index item from the property of an array
- PowerShell IE9 ComObject has all null properties after navigating to webpage
- Java: What does ~ mean
- PowerShell script runs when pasted into the PowerShell window, but not when run from shortcut
- PowerShell’s Invoke-RestMethod equivalent of curl -u (Basic Authentication)
- Remove files and foldes on Azure before a new deploy from VSTS
- Specifying *.xls filter in Get-ChildItem also returns *.xlsx results
- Inserting a date into SQL
- Can the following Nested foreach loop be simplified in PowerShell?
- Add Write-Progress to Get-Job/Wait-Job
- powershell function switch param with string array
- PowerShell launch script in new instance
- How to return specific data type from PowerShell function i.e. DataTable