Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1.5] - When used in a Azure Function SO level may return NULL #22

Open
AtleeRRN opened this issue Apr 5, 2024 · 0 comments
Open

[v1.5] - When used in a Azure Function SO level may return NULL #22

AtleeRRN opened this issue Apr 5, 2024 · 0 comments

Comments

@AtleeRRN
Copy link

AtleeRRN commented Apr 5, 2024

https://www.powershellgallery.com/packages/PS-NCentral/1.5

In a Azure function that pulls the module from the PSGallery. Its possible for $this.CustomerValidation to be $NULL when run against a NCOD instance. Likely because SO level is not 50 on a NCOD environment. And if you do not specify a default SO when connecting it will default to 50.

$this.CustomerValidation = @("customerid","customername","parentid") + ($this.customerlist($true) | ## only fetch SO for speed purposes

Quick and dirty fix would be to check for null like this, obviously error message could be improved upon:

	if ($null -ne $customer) {
		$this.CustomerValidation = ($customer | Get-Member | Where-Object {$_.membertype -eq "noteproperty"} ).name
	} else {
		Write-Output "Error"
		$this.CustomerValidation = $null
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant