The help says that $VerbosePreference should affect scripts, CMDLETS and providers. When setting the $VerbosePreference variable to Continue, the detailed output of the Stop-Process cmdlet does not appear, although it should, considering if you specify the Verbose parameter specifically, the verbose output is shown.
Can someone tell me why $VerbosePreference = ‘Continue’ does not affect on verbose output from Stop-Process?
I think thats actually the intention. Its been awhile since I’ve looked at that preference, and never really used it, but I took it as its setting the preference when verbose is called. Not that it sets everything to verbose and continue.
Out of curiosity, change continue to inquire, and run the lines again.
I talked myself into the reasoning.
A preference is what you want to happen when an “event” occurs.
In something like $erroractionpreference, it triggers on an error event.
In $Verbosepreference, the event only happens when you tell it to happen. So thats why itll work when you call it with the -verbose switch.
$VerbosePreference = ‘Inquire’ doesn’t work either.

I meant to run the other “lines”, as in all of them. Even the one with the -verbose switch after changing to inquire.
You’d have to look at CIM to see if it has default verbose, but also whats in the module you imported.
You could try not setting the $verbosepreference on the CIM example and see if it still shows Verbose output.
Take a look at the attached screenshot. First, i make sure that $VerbosePreference has a default value. Run the Get-CimInstance cmdlet without the Verbose parameter, and then with it. Next, change $VerbosePreference to ‘Continue’ and see that $VerbosePreference affects the Verbose output of this cmdlet.
Again, I think you’re just looking at the defaults of a cmdlet taking over from your preference set.
For instance,
$VerbosePreference = 'SilentlyContinue'
Get-CimInstance -ClassName win32_service -Verbose | Select-Object -First 1
Comes out how you’re seeing;
Get-CimInstance -ClassName win32_service -Verbose | Select-Object -First 1
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = win32_service'.
ProcessId Name StartMode State Status ExitCode
--------- ---- --------- ----- ------ --------
0 AJRouter Manual Stopped OK 1077
But using the older version, Get-WmiObject;
$VerbosePreference = 'SilentlyContinue'
Get-WmiObject -ClassName win32_service -Verbose | Select-Object -First 1
The preference is used;
Get-WmiObject -ClassName win32_service -Verbose | Select-Object -First 1
ExitCode : 1077
Name : AJRouter
ProcessId : 0
StartMode : Manual
State : Stopped
Status : OK
And there is no verbose output.
Is it a bug? A feature? I’m not sure.
I know some cmdlets have their own $preference, but I don’t know all of them. So this is more than likely a default preference of Get-CimInstance.
It seems that I myself and you have been misled. The guys from the local PowerShell chat told me that there is an open issue in the PowerShell repository. It says what if ShouldProcess use in function (most likely in cmdlets as well), then Verbose Preference is ignored. Apparently this is a feature, but not an obvious one.
Issue 12148




