Thanks for you feedback guys. I tested it with an simple example like this:
<script src=“https://gist.github.com/OCram85/08cb2d3b5b9f8d19009d30de59ed4f4b.js”></script>
[pre]
~\workspace\lab\ConfirmTest> .\Test-ConfirmMod.ps1
VERBOSE: Loading module from path ‘~\workspace\lab\ConfirmTest\ConfirmMod.psm1’.
VERBOSE: Exporting function ‘Invoke-MainFunc’.
VERBOSE: Exporting function ‘Invoke-SubFunc’.
VERBOSE: Importing function ‘Invoke-MainFunc’.
VERBOSE: Importing function ‘Invoke-SubFunc’.
============== Invoke-Mainfunc -message ‘foo’ ==================
VERBOSE: Confirm is:
VERBOSE: Confirm is present: False
VERBOSE: PSBound is:
VERBOSE: Invoke.PSBound is present: False
VERBOSE: Invoke.PSBound is:
VERBOSE: Sub Confirm is:
VERBOSE: Sub Confirm is present: False
VERBOSE: Sub PSBound is:
VERBOSE: Sub Invoke.PSBound is present: False
VERBOSE: Sub Invoke.PSBound is:
----------- Invoke-Mainfunc -message ‘foo’ -Confirm --------------------
VERBOSE: Confirm is:
VERBOSE: Confirm is present: True
VERBOSE: PSBound is: True
VERBOSE: Invoke.PSBound is present: True
VERBOSE: Invoke.PSBound is: True
VERBOSE: Sub Confirm is:
VERBOSE: Sub Confirm is present: False
VERBOSE: Sub PSBound is:
VERBOSE: Sub Invoke.PSBound is present: False
VERBOSE: Sub Invoke.PSBound is:
Confirm
Are you sure you want to perform this action?
Performing the operation “Output to File” on target “~\workspace\lab\ConfirmTest\foobartest.txt”.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Yes”):
Confirm
Are you sure you want to perform this action?
Performing the operation “Remove File” on target “~\workspace\lab\ConfirmTest\foobartest.txt”.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Yes”):
----------- Invoke-MainFunc -message ‘foo’ -Confirm:$false --------------------
VERBOSE: Confirm is:
VERBOSE: Confirm is present: True
VERBOSE: PSBound is: False
VERBOSE: Invoke.PSBound is present: True
VERBOSE: Invoke.PSBound is: False
VERBOSE: Sub Confirm is:
VERBOSE: Sub Confirm is present: False
VERBOSE: Sub PSBound is:
VERBOSE: Sub Invoke.PSBound is present: False
VERBOSE: Sub Invoke.PSBound is:
----------- Invoke-Mainfunc -message ‘foo’ -Confirm:$true --------------------
VERBOSE: Confirm is:
VERBOSE: Confirm is present: True
VERBOSE: PSBound is: True
VERBOSE: Invoke.PSBound is present: True
VERBOSE: Invoke.PSBound is: True
VERBOSE: Sub Confirm is:
VERBOSE: Sub Confirm is present: False
VERBOSE: Sub PSBound is:
VERBOSE: Sub Invoke.PSBound is present: False
VERBOSE: Sub Invoke.PSBound is:
Confirm
Are you sure you want to perform this action?
Performing the operation “Output to File” on target “~\workspace\lab\ConfirmTest\foobartest.txt”.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Yes”):
Confirm
Are you sure you want to perform this action?
Performing the operation “Remove File” on target “~\workspace\lab\ConfirmTest\foobartest.txt”.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Yes”):
[/pre]
… And yes you were absolutely right. The Confirm switch worked like expected.
Unfortunately only here in this lab scenario an not im my module/ function.
If you are still interested in the actual problem you can take a look the project here
The function New-CredentialStore -Confirm calls New-PfxCertificate. New-PfxCertificate tries to delete files and the confirm dialog doesn’t appear.
I only get a confirm dialog for actions inside New-CredentialStore itself.
So do you have any idea what could go wrong 