I've been tasked with heading up a storage migration where I am currently employed.

We have both 7-Mode and CDOT systems here (NetApp), and I wanted a way to run different functions with varying options based on each OS. 

To do this I created a couple variables up front:

$accountRun and $NetAppControllers.

$accountRun simply gets the account name you're running PowerShell as.

$accountRun               = (Get-ChildItem ENV:username).Value

$netAppControllers is an array of your controllers.

$global:NetAppControllers = @("controller1","controller2-c")

Notice how controller2 has -c after it. This is used in the below code to delineate between 7-Mode and CDOT controllers.

function Connect-NetAppController {

    $i = 0
    Write-Host `n"NetApp Controllers"`n -ForegroundColor $foregroundColor

    foreach ($n in $NetAppControllers) { 
    
        if ($n.Split("-")[1] -like "*c*"){

            Write-Host $i -NoNewline
            Write-Host -> -NoNewLine -ForegroundColor $foregroundcolor 
            Write-Host $n.Split("-")[0]  -NoNewline
            Write-Host "(CDOT)" -ForegroundColor $foregroundColor

        } else {

            Write-Host $i -NoNewline
            Write-Host -> -NoNewLine -ForegroundColor $foregroundcolor 
            Write-Host $n 

        }

        $i++

}
    Write-Host `n

    $selection = Read-Host "Which #?"
    
    if (($netAppControllers[$selection]).Split("-")[1] -like "*c*") { 
    Write-Host ($netAppControllers[$selection]).Split("-")[0]
        $nController = $netAppControllers[$selection].Split("-")[0]
        
        Write-Host `n"Attempting to connect to: " $nController "(CDOT)"`n -ForegroundColor $foregroundColor
        
        if (Test-Connection $nController -Count 1 -Quiet) {
            
        Write-Host `n"We are able to connect to:" $nController "... gathering credentials."`n -foregroundcolor $foregroundColor
        
        $netAppCredential = Get-Credential -UserName $accountRun.ToLower() -Message "Enter NetApp Credentials for $nController"
       
        Connect-NcController $nController -Credential $netAppCredential | Out-Null

        Get-CDOTInfo $netAppCredential $nController
    
        } Else {
            
            Write-Host `n"Unable to ping: " $nController`n -foregroundcolor Red
            
        }

    } else {

        $7Controller = $NetAppControllers[$selection]
        
        Write-Host `n"Attempting to connect to: " $7Controller`n -ForegroundColor $foregroundColor

        if (Test-Connection $NetAppControllers[$selection] -Count 1 -Quiet) {
        
        $7Controller = $NetAppControllers[$selection]
            
        Write-Host `n"We are able to connect to:" $7Controller "... gathering credentials."`n -foregroundcolor $foregroundColor 
            
        $netAppCredential = Get-Credential -UserName $accountRun.ToLower() -Message "Enter NetApp Credentials for $nController"

        Connect-NaController $NetAppControllers[$selection] -Credential $netAppCredential | Out-Null

        Get-7ModeInfo $netAppCredential $NetAppControllers[$selection]
       
         } Else {
            
            Write-Host `n"Unable to ping: " $7Controller`n -foregroundcolor Red
            
        }
         
     }
  }

Let me know what you think, xor you have any ideas!