07-21-2023, 07:33 PM
I want to test to see if a variable has been assigned a variable and if not perform action. How can this be achieve?
I've attempted it with the following code but receive the error: The right operand of '-is' must be a type.
$ProgramName is not assigned at this point.
If ($ProgramName -isnot $null) {
$ProgramName = $ProgramName + ', ' + $cncPrograms
}
Else {
If ($cncPrograms -isnot $null) {
$ProgramName = $cncPrograms
}
}
I've attempted it with the following code but receive the error: The right operand of '-is' must be a type.
$ProgramName is not assigned at this point.
If ($ProgramName -isnot $null) {
$ProgramName = $ProgramName + ', ' + $cncPrograms
}
Else {
If ($cncPrograms -isnot $null) {
$ProgramName = $cncPrograms
}
}