Microsoft Virtualization Discussions

Bug ?

raol
3,147 Views

Just came across something... wasn't sure if it was a Toolkit issue or PowerShell issue....

Please see below the output... trying to filter licenses and can't seem to do it properly...

Licenses masked to prevent misuse...

MS PowerShell 2.0

DataONTAP Toolkit v1.6

===== Begin Output =====

PS C:\Users> Get-NaLicense

Service                        Licensed Code       Installation   Expiration

-------                        -------- ----       ------------   ----------

a_sis                            True   XXXXXXX       3/15/2011

cf                               True   XXXXXXX       3/15/2011

cf_remote                       False

cifs                             True   XXXXXXX       7/27/2011

compression                     False

disk_sanitization                True   XXXXXXX       7/20/2011

fcp                             False

flex_clone                      False

flex_scale                      False

flexcache_nfs                    True   XXXXXXX       3/15/2011

http                             True   XXXXXXX       3/15/2011

iscsi                           False

multistore                       True   XXXXXXX       3/15/2011

nearstore_option                 True   XXXXXXX       3/15/2011

nfs                              True   XXXXXXX       3/15/2011

operations_manager              False

pamii                            True   XXXXXXX       3/15/2011

protection_manager              False

provisioning_manager            False

smdomino                        False

smsql                           False

snapdrive_unix                  False

snapdrive_windows               False

snaplock                        False

snaplock_enterprise             False

snapmanager_hyperv              False

snapmanager_oracle              False

snapmanager_sap                 False

snapmanager_sharepoint          False

snapmanagerexchange             False

snapmirror                      False

snapmirror_sync                 False

snapmover                       False

snaprestore                     False

snapvalidator                   False

sv_applications_pri             False

sv_exchange_pri                 False

sv_linux_pri                    False

sv_marketing_pri                False

sv_ontap_pri                    False

sv_ontap_sec                    False

sv_oracle_pri                   False

sv_sharepoint_pri               False

sv_sql_pri                      False

sv_unix_pri                     False

sv_vi_pri                       False

sv_vmware_pri                   False

sv_windows_ofm_pri              False

sv_windows_pri                  False

syncmirror_local                 True   XXXXXXX       3/15/2011

vld                             False

v-series                        False

PS C:\Users> Get-NaLicense | where {$_.Licensed -eq "True"}

Service                        Licensed Code       Installation   Expiration

-------                        -------- ----       ------------   ----------

a_sis                            True   XXXXXXX       3/15/2011

cf                               True   XXXXXXX       3/15/2011

cifs                             True   XXXXXXX       7/27/2011

disk_sanitization                True   XXXXXXX       7/20/2011

flexcache_nfs                    True   XXXXXXX       3/15/2011

http                             True   XXXXXXX       3/15/2011

multistore                       True   XXXXXXX       3/15/2011

nearstore_option                 True   XXXXXXX       3/15/2011

nfs                              True   XXXXXXX       3/15/2011

pamii                            True   XXXXXXX       3/15/2011

syncmirror_local                 True   XXXXXXX       3/15/2011

PS C:\Users> Get-NaLicense | where {$_.Licensed -eq "False"}

Service                        Licensed Code       Installation   Expiration

-------                        -------- ----       ------------   ----------

a_sis                            True   XXXXXXX       3/15/2011

cf                               True   XXXXXXX       3/15/2011

cifs                             True   XXXXXXX       7/27/2011

disk_sanitization                True   XXXXXXX       7/20/2011

flexcache_nfs                    True   XXXXXXX       3/15/2011

http                             True   XXXXXXX       3/15/2011

multistore                       True   XXXXXXX       3/15/2011

nearstore_option                 True   XXXXXXX       3/15/2011

nfs                              True   XXXXXXX       3/15/2011

pamii                            True   XXXXXXX       3/15/2011

syncmirror_local                 True   XXXXXXX       3/15/2011

1 ACCEPTED SOLUTION

bsti
3,147 Views

Try this instead:

Get-NaLicense | where { $_.Licensed }

and

Get-NaLicense | where { !$_.Licensed }

Also, this works:

Get-NaLicense | where { $_.Licensed -eq $true }

and

Get-NaLicense | where { !$_.Licensed -eq $false }

You are comparing a boolean value to a string.  In PoSH, any non-blank string more or less equates to "true".  To get your statement to work with strings, you'd do a where { $_.Licensed -eq "" } to get false.

View solution in original post

2 REPLIES 2

bsti
3,148 Views

Try this instead:

Get-NaLicense | where { $_.Licensed }

and

Get-NaLicense | where { !$_.Licensed }

Also, this works:

Get-NaLicense | where { $_.Licensed -eq $true }

and

Get-NaLicense | where { !$_.Licensed -eq $false }

You are comparing a boolean value to a string.  In PoSH, any non-blank string more or less equates to "true".  To get your statement to work with strings, you'd do a where { $_.Licensed -eq "" } to get false.

raol
3,147 Views

Thanks... this works...

My mistake was treating it as a string...

Public