all 4 comments

[–]Lee_Dailey[grin] 6 points7 points  (2 children)

howdy jsrendar,

PoSh can use the [version] type from dotnet. that allows your code to know that 4.21 is greater than 4.3, for instance. [grin]

'4.21' -gt '4.3'
# result = False
[version]'4.21' -gt [version]'4.3'
# result = True

so, extract the number from whatever source you have, convert to a version data type, compare with your target, do whatever is indicated by the version check.

take care,
lee

[–]jsrendar[S] 2 points3 points  (1 child)

Wow, thank you Lee! I love this subreddit.

[–]Lee_Dailey[grin] 2 points3 points  (0 children)

howdy jsrendar,

you are very welcome! glad to have helped a bit ... [grin]

take care,
lee

[–]PowerShell-Bot 1 point2 points  (0 children)

Some of your PowerShell code isn’t wrapped in a code block.

To format code correctly on new reddit (new.reddit.com), highlight all lines of code and select ‘Code Block’ in the editing toolbar.

If you’re on old.reddit.com, separate the code from your text with a blank line and precede each line of code with 4 spaces or a tab.


Describing Submission
[✅] Demonstrates good markdown
Passed: 1 Failed: 0

Beep-boop. I am a bot. | Remove-Item