Hi Guys,
I just have a quick function question. I'm getting in the habit of compartmentalizing my scripts into functions, and I'm running into a small issue. I'm trying to pass a variable back out of that function and make it accessible by other functions and script items. Here is an example :
function Get-Chassis {
cls
Write-Output "Getting chassis type of current system..."
switch ($chassis){
"1" { $systemtype = "VM" }"3" { $systemtype = "Desktop" }"8" { $systemtype = "Laptop" }"9" { $systemtype = "Laptop" }"10" { $systemtype = "Laptop" }"11" { $systemtype = "Laptop" }"12" { $systemtype = "Laptop" }"14" { $systemtype = "Laptop" }
DEFAULT {$systemtype = "Other"}
}
Append-LogContent "Current system is $systemtype!"
}I am just trying to have this function as a tumbler for some post image apply options but for that to work, I need it to pass $systemtype back to the main post-apply script. Right now it's stuck in that function only. Help would be appreciated :) Thanks!