0 Comments

 

https://stackoverflow.com/questions/8095638/how-do-i-negate-a-condition-in-powershell

 

 

function FolderExists {

    param($folder)

 

    $folderExists = Test-Path “$($folder)”

    If ($folderExists -eq $True) {

        Write-Host “Folder [$($folder)] exists.”

    } Else {

        Write-Host “Folder [$($folder)] does NOT exist.”

    }

    return $folderExists

}

 

if(-Not (FolderExists -folder “C:\ThisFolderDoesNotExistOnThisSystem”)) {

    Write-Host “Folder does not exists!!!!!”

<

p style=”background: #1e1e1e”>}

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts