powershell - Function within If echoing to console -


i using code means of validating user or group in advance of setting permissions on folder , in aspect works great.

however, somehow if returning 0. if remove out if don't 0 echo console. if rem out add within if still 0. it's in if. have never seen info returned when part of if.

try {    if (-not ((new-object system.security.principal.ntaccount($principal)).translate([system.security.principal.securityidentifier]))) {        $filepermissions.error.add("'$principal' not valid user or group")    } } catch {    $filepermissions.error.add("'$principal' not valid user or group") } 

i tried adding > $nulls in if, this

if (-not ((new-object system.security.principal.ntaccount($principal) > $null).translate([system.security.principal.securityidentifier]) > $null)) { 

and still see 0. fundamental happening, related new-object suspect, not understanding it.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -