I have a strange problem, i have a very simple function.
This is my powershell code
$exclude = @()
function GetOracleDb {
param([string]$servername)
$exclude += $servername
}
GetOracleDb "Myserver2"
$exclude
Why my $exclude array is empty?
Thanks for your help
change it like this:
$global:exclude += $servername
The scope of $exclude inside a function is different from this one outside.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.