Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
ITEngineer
Posts: 210 Joined: Wed Oct 12, 2011 10:52 am
Post
by ITEngineer » Thu Dec 13, 2018 4:44 am
jvierra wrote: ↑ Wed Dec 12, 2018 11: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:
Do I just set the command switch below to make it happens?
$WhatIfPreference = $
true
$global:ShouldProcess = $
true
/* IT Engineer */
jvierra
Posts: 14676 Joined: Tue May 22, 2007 9:57 am
Answers: 6
Has voted: 1 time
Been upvoted: 5 times
Contact:
Post
by jvierra » Thu Dec 13, 2018 12:06 pm
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>
jvierra
Posts: 14676 Joined: Tue May 22, 2007 9:57 am
Answers: 6
Has voted: 1 time
Been upvoted: 5 times
Contact:
Post
by jvierra » Thu Dec 13, 2018 12:41 pm
I have modified the example to produce extra messages that make what is happening easier to understand - I think.
Attachments
Remove-Office.ps1
(2.58 KiB) Downloaded 64 times