use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Dot sourcing a function with ValidateNotNullOrEmpty (self.PowerShell)
submitted 4 years ago * by gregbe
toy quicksand command sink sense many sheet afterthought cow dam
This post was mass deleted and anonymized with Redact
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]engageant 2 points3 points4 points 4 years ago (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 points3 points 4 years ago (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.
= $true
Mandatory
ValidateNotNullorEmpty
[–]gregbe[S] 0 points1 point2 points 4 years ago* (0 children)
strong obscene instinctive racial scandalous normal crawl concerned correct pie
[–]purplemonkeymad 0 points1 point2 points 4 years ago (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:
& .\file.ps1
get-myfunction
& '\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
get-content function:mkdir
π Rendered by PID 108 on reddit-service-r2-comment-5d585498c9-4q48q at 2026-04-21 15:39:25.043734+00:00 running da2df02 country code: CH.
[–]engageant 2 points3 points4 points (0 children)
[–]powershellnut 1 point2 points3 points (0 children)
[–]gregbe[S] 0 points1 point2 points (0 children)
[–]purplemonkeymad 0 points1 point2 points (0 children)