-WhatIf

Editor
Sep 8, 2010 at 9:38 AM

In PowerShell, everything supports “ubiquitous switches” like –whatif.

How about being able to

Add-Package –whatif nhibernate

And I’ll see where it’s getting it from and output of WHAT it would do without actually doing it.


Example:

PS C:\Users\Scott\Desktop> del -WhatIf *.jpg

What if: Performing operation "Remove File" on Target "C:\Users\Scott\Desktop\JonTorresdal.jpg".

What if: Performing operation "Remove File" on Target "C:\Users\Scott\Desktop\netduinodebugging.JPG".

What if: Performing operation "Remove File" on Target "C:\Users\Scott\Desktop\photo.JPG".

What if: Performing operation "Remove File" on Target "C:\Users\Scott\Desktop\psp1.JPG".

What if: Performing operation "Remove File" on Target "C:\Users\Scott\Desktop\psp2.JPG".

What if: Performing operation "Remove File" on Target "C:\Users\Scott\Desktop\psp3.JPG".

--

Scott Hanselman – Developer Community Liaison – Microsoft

Blog and Podcast: http://hanselman.com – Twitter: @shanselman

Developer
Sep 8, 2010 at 9:40 AM

We spoke about supporting this a long time ago, but nothing ever came of it. We'd have to add some plumbing to the core for this also. Do you think it's a high priority?

Sep 8, 2010 at 9:44 AM

Let's track it as a nice-to-have thing.  I don't think it's a much have for v1 if it's hard to do.

Editor
Sep 8, 2010 at 9:45 AM

Considering that –whatif is literally ubiquitous (every built in powershell thing has it) PLUS it’s always nice to know what will happen to your project when you’re about to do a destructive procedure, I think it’s pretty high.

http://msdn.microsoft.com/en-us/library/ms714627(VS.85).aspx

http://blogs.msdn.com/b/powershell/archive/2007/02/25/supporting-whatif-confirm-verbose-in-scripts.aspx

From: dfowler [mailto:notifications@codeplex.com]
Sent: Wednesday, September 08, 2010 1:41 AM
To: Scott Hanselman
Subject: Re: -WhatIf [nupack:226422]

From: dfowler

We spoke about supporting this a long time ago, but nothing ever came of it. We'd have to add some plumbing to the core for this also. Do you think it's a high priority?

Read the full discussion online.

To add a post to this discussion, reply to this email (nupack@discussions.codeplex.com)

To start a new discussion for this project, email nupack@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Editor
Sep 8, 2010 at 9:48 AM

It might be useful to talk to Lee Holmes or Jeffrey Snover as there may be some facilities or patterns that can easily enable this.

From: davidebb [mailto:notifications@codeplex.com]
Sent: Wednesday, September 08, 2010 1:45 AM
To: Scott Hanselman
Subject: Re: -WhatIf [nupack:226422]

From: davidebb

Let's track it as a nice-to-have thing. I don't think it's a much have for v1 if it's hard to do.

Read the full discussion online.

To add a post to this discussion, reply to this email (nupack@discussions.codeplex.com)

To start a new discussion for this project, email nupack@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Developer
Sep 8, 2010 at 9:49 AM

We still need to do plumbing within the core. Should we support -confirm also? (we can't right now) I don't think this is a must have for v1 but we can see what others think.

Editor
Sep 8, 2010 at 9:54 AM

Personally, since –confirm can actually get the system into a BAD state (like, what would you ask confirmation for? What if they said no? etc etc) then I’d say no.


But the more I noodle on it, -whatif is Pri 2 (is that like 2nd?) I’d be interested in the non-MSFT folks opinions also.


Scott

From: dfowler [mailto:notifications@codeplex.com]
Sent: Wednesday, September 08, 2010 1:50 AM
To: Scott Hanselman
Subject: Re: -WhatIf [nupack:226422]

From: dfowler

We still need to do plumbing within the core. Should we support -confirm also? (we can't right now) I don't think this is a must have for v1 but we can see what others think.

Read the full discussion online.

To add a post to this discussion, reply to this email (nupack@discussions.codeplex.com)

To start a new discussion for this project, email nupack@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Sep 8, 2010 at 12:04 PM

To me this is a nice to have for two reasons.

1. There is a remove-package command
2. I use source control. I can use that to diff before and after states, as well as rollback a installation.

Sep 8, 2010 at 1:01 PM

Agree that NuPack is destructive but nothing you can't back out of with source control or the system itself (assuming you trust the Remove- cmdlets). It is a nice to have along with a -Confirm and -Verbose, but not a V1.

Coordinator
Sep 8, 2010 at 4:20 PM

Agree, this is a nice to have. Please do log it. For example, I wouldn't take this feature in lieu of the package creation features.