troubleshooting Question

Powershell: Returning Results

Avatar of ivan rosa
ivan rosaFlag for United States of America asked on
8 Comments1 Solution42 ViewsLast Modified:
Hi Folks,
Problem: I'm  trying to create a function in which within, it has few IF, in which depending what the input is, will give me specific Variables. However doesn't seem to be returning anything.

First attempt:
$input = West
function Get-Reg {
    if ($null -eq $Input) {
      write "no input has been made"
    if ($input -eq "West") {
        $tempFile = 'C:\temp\tempFileW.json'
        $tempParam = 'C:\Temp\tempParamw.json'
        $Location = 'West'
        return $templateFile, $templateParameters,$RGLocation  
    if ($input -eq "East") {
        $tempFile = 'C:\temp\tempFileE.json'
        $tempParam = 'C:\Temp\tempParamE.json'
        $Location = 'East'
        return $templateFile, $templateParameters,$RGLocation  
   get-cmdlet -param1 $tempFile -param2 $tempParam -param3 $Location

Any thoughts?
thank for taking a look.

PS.The only way i get it to work is, if i keep on repeating my code over and over, but I'm trying to stay away from DRY code...

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros