VMware Cloud Community
drwoodberry
Contributor
Contributor

Confirm any "Set" commandlet?

I am not sure if this is just me, or others are experiencing this issue, but I am in the process of modifying scripts I wrote using the 4.0 CLI to work with 4.1 PowerCLi. I have noticed outside the fact that you can no longer use $null for a password variable..it has to be an empty string, but that it seems that every statement that uses "Set" requires the -Confirm:$false to be in the command. In 4.0 this was not the case. Is this a common change? I have not downloaded or read the latest 4.1 cmdlet reference, but I was curious if this was normal and why.

Thanks.

0 Kudos
8 Replies
LucD
Leadership
Leadership

Did you already check if the $ConfirmPreference variable is still set to the same value ?

A cmdlet can be marked to have a high, medium or low impact.

If you set the $ConfirmPreference to high, you will only need to confirm the cmdlets marked to have a high impact.

I don't have a PowerCLI 4.0 installation handy to check but it is possible the developers changed the impact of some cmdlets in 4.1

It's not mentioned in the changelog or in the release notes.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
drwoodberry
Contributor
Contributor

I just checked that variable on both the 4.1 and 4.0 environment and they were both set to "High."  Is there something that shows what the cmdlet will be marked as?

I was looking through the cmdlet reference guide but I did not see it. It is not a huge deal, it just caught me off guard. My scripts were stalling when trying to run them in a custom gui and I did not know why.I had to run them from the PowerCLi to see that it was waiting for a confirmation from the cmdlet. Oh well. Atleast it is now out there for people to read about incase they have the same issue.

0 Kudos
LucD
Leadership
Leadership

Everything is possible with PS Smiley Wink

This will list all PowerCLI cmdlets and the ConfirmImpact, as defined by the cmdlet developer.

Get-Command -Module VMware.VimAutomation.Core | %{
    New-Object System.Management.Automation.CommandMetadata (Get-Command $_.Name) | `
    Select Name,ConfirmImpact }


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

LucD
Leadership
Leadership

I expanded the previous script a bit.

Have a look in PowerCLI cmdlet XRef – Another look


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

drwoodberry
Contributor
Contributor

Thanks so much for this. I will be looking over it and trying to see if the Confirm Action Priority changed between the two different versions. I am not sure why it would, but this behavior did occur.

0 Kudos
LucD
Leadership
Leadership

Yes, I'm curious to see the CSV files for both PowerCLI versions.

There are some other oddities in the CSV 🙂


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
drwoodberry
Contributor
Contributor

Here are the two outputs from the two environments. At first glance I did not see much different for the cmdlet's I was using but that does not mean I did not overlook anything.

0 Kudos
LucD
Leadership
Leadership

I combined them in 1 CSV file and it looks indeed as if the ConfirmImpact didn't change for any of the Set- cmdlets.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos