Page 2 of 2

Re: Using PowerShell to detect and remove certain type of software?

Posted: Thu Dec 13, 2018 3:44 am
by ITEngineer
jvierra wrote: Wed Dec 12, 2018 10:03 pm PowerShell 2 is no longer supported by Microsoft. It is considered a security problem. You need to upgrade.

PS does not support most of the extensions to PS at V3 and later. Just add the "= $true" to the "[Parameter(" statement

[Parameter(Mandatory=$true)]
Mr. Vierra,

Thanks for the update, I can see the script is now working:

Image

Do I just set the command switch below to make it happens?

$WhatIfPreference = $true
$global:ShouldProcess = $true

Re: Using PowerShell to detect and remove certain type of software?

Posted: Thu Dec 13, 2018 11:06 am
by jvierra
To further modify the design to obtain the desired behaviors we can use PwoerShell's built-in capability of setting and managing the preferences dynamically.

Here is how that is accomplished in code.

<file to be posted>

Re: Using PowerShell to detect and remove certain type of software?

Posted: Thu Dec 13, 2018 11:41 am
by jvierra
I have modified the example to produce extra messages that make what is happening easier to understand - I think.