Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
error: Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or
empty, and then try the command again.
This is because in the scope of the scriptblock, your variable does not exist. The script block runs in an independent scope where no variables in the local/calling scope are available. You can pass it with the parameter ArgumentList or use the $using: scope modifier to access local variables.
brittneyr wrote: ↑Thu Jan 12, 2023 7:40 am
This is because in the scope of the scriptblock, your variable does not exist. The script block runs in an independent scope where no variables in the local/calling scope are available. You can pass it with the parameter ArgumentList or use the $using: scope modifier to access local variables.
sorry, i should have said that the computer name is passed as a parameter.
it works correctly up to the point where i try to use some dynamic variable.
This topic is 1 year and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.