Powershell参考参数

时间:2016-02-22 16:59:55

标签: powershell

我正在制作一个powershell脚本来配置SharePoint中的用户配置文件属性。但是,“$ bChanged”属性未被引用回调用函数。我以为参数总是通过引用传递?

function UpdateProperty($listproperty, $upproperty) {
    Write-Host "Lets call the function" + $upproperty.Name;
    $bChanged=$false;
    UpdatePropertyProperty $upproperty.DisplayName $listproperty.DisplayName $bChanged;
    #UpdatePropertyProperty $upproperty.disaplyOrder $listproperty.disaplyOrder $bChanged;
    #...

    if ($bChanged) {
        $upproperty.Commit();
        Write-Host "Property updated: " $upproperties.Name;
    }
}

function UpdatePropertyProperty($listpropprop, $uppropprop, $bChanged){
    if ($uppropprop -ne $listpropprop) {
        $bChanged=$true;
        $uppropprop = $listpropprop;
    }
}

0 个答案:

没有答案