hi all,<\/p>\n
i have a powershell script that looks at a csv file with columns like<\/p>\n
fn,ln,pw,dom,ofc,dist<\/p>\n
now most of them are populated but “dist” columns arnt as some users dont want to be added to any dist group on o365<\/p>\n
how can i do this please, i thought about an if statement within my foreach loop, like so, il give you a snippet<\/p>\n
$maildist = $mail.dist<\/p>\n
if ($maildist -eq “value”){<\/p>\n
Add-DistributionGroupMember -Identity $maildist -Member $mailids}<\/p>\n
obviously theres more to the script but you get the idea<\/p>\n
so if the cell contains a value do the command, and if it doesnt, dont run the command<\/p>\n
thanks,<\/p>\n
rob<\/p>","upvoteCount":12,"answerCount":14,"datePublished":"2022-04-28T15:45:20.000Z","author":{"@type":"Person","name":"robertkwild","url":"https://community.spiceworks.com/u/robertkwild"},"suggestedAnswer":[{"@type":"Answer","text":"
hi all,<\/p>\n
i have a powershell script that looks at a csv file with columns like<\/p>\n
fn,ln,pw,dom,ofc,dist<\/p>\n
now most of them are populated but “dist” columns arnt as some users dont want to be added to any dist group on o365<\/p>\n
how can i do this please, i thought about an if statement within my foreach loop, like so, il give you a snippet<\/p>\n
$maildist = $mail.dist<\/p>\n
if ($maildist -eq “value”){<\/p>\n
Add-DistributionGroupMember -Identity $maildist -Member $mailids}<\/p>\n
obviously theres more to the script but you get the idea<\/p>\n
so if the cell contains a value do the command, and if it doesnt, dont run the command<\/p>\n
thanks,<\/p>\n
rob<\/p>","upvoteCount":12,"datePublished":"2022-04-28T15:45:20.000Z","url":"https://community.spiceworks.com/t/if-excel-cell-has-value-do-or-else-dont/831557/1","author":{"@type":"Person","name":"robertkwild","url":"https://community.spiceworks.com/u/robertkwild"}},{"@type":"Answer","text":"
think you need to use the ISNULL function, assuming the cell truly has no value and not a space or 0 or something like that<\/p>","upvoteCount":0,"datePublished":"2022-04-28T15:48:35.000Z","url":"https://community.spiceworks.com/t/if-excel-cell-has-value-do-or-else-dont/831557/2","author":{"@type":"Person","name":"Kenny8416","url":"https://community.spiceworks.com/u/Kenny8416"}},{"@type":"Answer","text":"