I'm trying to use the best practices library for PowerShell, but I keep getting this error:
You cannot call a method on a null-valued expression.
For some reason the $request is always empty when I try to use any of the functions in the library.
Here's an example of the code I'm using:
function onInit($context) {
$context.UseLibraryScript('Script Modules/Library/One-Identity-Libary')
}
function onPreModify($Request) {
if ($Request.Class -ne "user") { return }
$tieredAttributes = @(
'edsvaTier1Required'
'edsvaTier2Required'
'edsvaTier3Required'
)
if (AreAttributesModified($tieredAttributes, $Request)) {
#do stuff with attributes
}
}
I also tried adding $Request | Get-Member | Out-File C:\Request.txt to the functions in library, this generates an empty file.
Am I missing something obvious?