Powershell script call function based on value in excel cell

Absar 21 Reputation points
2020-08-05T16:21:32+00:00

I am looking for a way to take appropriate action or call function based on value in cell of excel.
e.g. if cell value has true then enable user for Skype Enterprise Voice and if value is false then first enable for Skype and then for EV as well. Similarly create other EV related objects e.g. CAP phone, RGS

can someone pls help what code should I write in script

Skype for Business
Skype for Business
A Microsoft communications service that provides communications capabilities across presence, instant messaging, audio/video calling, and an online meeting experience that includes audio, video, and web conferencing.
606 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,396 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 45,111 Reputation points
    2020-08-06T18:46:25.42+00:00

    I don't know how you are representing True/False in your worksheet. So the "<true-value>" in code below may be a single digit "1" or a Boolean value TRUE, or just plain text "true", so make the necessary adjustment in the conditional statement.

    if ((<get-cell-value>) -eq <true-value>){
        # enable user for Skype Enterprise Voice
    }
    else{
        # enable use for Skype
        # enable user for Skype Enterprise Voice
    }
    
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Rich Matheisen 45,111 Reputation points
    2020-08-05T18:47:28.25+00:00

    Are you asking how to read data from an Excel file? Or are you asking how to determine what to do based on the data you read from an Excel cell? Or are you asking how to enable a user for Sykpe EV, or Skype, the EV, then some other things?

    If you want to read data from an Excel file you have two choices: use a COM object (which probably won't exist on a server), or use the ImportExcel module (a much better way . . . here's a link to explain and get you started read-and-write-excel-spreadsheets-with-the-importexcel-powershell-module .

    Once you've got the worksheet and checked the value in the cell, it's just a regular "if/then" statement in which you'll take the necessary actions.

    0 comments No comments

  2. Absar 21 Reputation points
    2020-08-06T13:26:30.77+00:00

    "are you asking how to determine what to do based on the data you read from an Excel cell "

    your above statement is what I am trying to achieve/do

    0 comments No comments