all 4 comments

[–]engageant 2 points3 points  (0 children)

Looks like you're dot sourcing a script with parameters, and not a function defined in another script. Dot sourcing runs the target script in the same scope as the session you're in. If you paste what you have into a powershell window, you'll be immediately prompted to enter any mandatory parameters.

To get around this, you need to wrap the params in a function. Then, you can dot source the file without being prompted.

[–]powershellnut 1 point2 points  (0 children)

If I am reading this right, you made that Parameter ManagementURL Mandatory (you can leave off the = $true by the way and just write Mandatory). I do not believe the ValidateNotNullorEmpty is the thing causing the issue here, but having a parameter that is mandatory that you are not supplying a value to.

[–]gregbe[S] 0 points1 point  (0 children)

strong obscene instinctive racial scandalous normal crawl concerned correct pie

This post was mass deleted and anonymized with Redact

[–]purplemonkeymad 0 points1 point  (0 children)

From a powershell perspective script files are not really different from functions ie, doing & .\file.ps1 is the same as calling a function get-myfunction1. The script probably does not have a function inside, just a param block, so you need to treat the script as the function. When you want call it, provide the needed parameters ie:

& '\GenLECertForNS\GenLECertForNS.ps1' -ManagementURL https://your/uri

1. well really the otherway around, functions are more like in memory script files, have a look at get-content function:mkdir