# Running powershell Not-if statements

**URL:** <https://discourse.chef.io/t/running-powershell-not-if-statements/2407>\
**Category:** Chef Infra (archive)\
**Created:** [January 30, 2012, 9:05am UTC](https://discourse.chef.io/t/running-powershell-not-if-statements/2407 "2012-01-30T09:05:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madhurranjan\_Mohaan](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@Madhurranjan\_Mohaan](https://discourse.chef.io/u/Madhurranjan_Mohaan)\
**Post date:** [January 30, 2012, 9:05am UTC](https://discourse.chef.io/t/running-powershell-not-if-statements/2407/1 "2012-01-30T09:05:22Z")

</div>

Hi Experts,

I am trying to run a few powershell “Not\_if” statements and they don’t work  
. WIndows works with any statement that would work on Windows command line  
but not things that run through powershell( is what I have seen). Can you  
tell me if you have experienced and solved this issue?

Thanks

Ranjan

---

<div class="post-metadata">

**Author:** ![Ranjib\_Dey](https://avatars.discourse-cdn.com/v4/letter/r/8e8cbc/32.png) [@Ranjib\_Dey](https://discourse.chef.io/u/Ranjib_Dey)\
**Post date:** [January 30, 2012, 9:18am UTC](https://discourse.chef.io/t/running-powershell-not-if-statements/2407/2 "2012-01-30T09:18:50Z")

</div>

i think, the not\_if "" variety would take stuff that can be run in command  
line, while the not\_if{} variety will take pure ruby stuff that evaluates  
into true or false, so you need to model your resource such that it can  
be leveraged by either of these two form to make it idempotent.

regards  
ranjib

On Mon, Jan 30, 2012 at 2:35 PM, Madhurranjan Mohaan \<  
[maadhuuranjan.m@gmail.com](mailto:maadhuuranjan.m@gmail.com)\> wrote:

> Hi Experts,
> 
> I am trying to run a few powershell "Not\_if" statements and they don't  
> work . WIndows works with any statement that would work on Windows command  
> line but not things that run through powershell( is what I have seen). Can  
> you tell me if you have experienced and solved this issue?
> 
> Thanks
> 
> Ranjan
