Probably because the toothache did not sleep well, today is always making mistakes, or the script is wrong, especially difficult to adjust.
First error:
In a PowerShell script, functions and functions call each other's arguments. In fact, just like calling a normal cmdlet, you should write this:
$adminAddr $newScope $objectList
Look what I wrote:
Add-scopeobject ($adminAddr$newScope$objectList)
The results of the implementation of the wrong, I am anxious ah. I'm in the Add-scopeobject function crazy printing parameters:
$adminAddr >> C:\Users\admin\Desktop\ output \adminaddr222.txt $name >> C : \users\admin\desktop\ output \name222.txt $objectList >> C:\Users\admin\Desktop\ output \ ObjectList222.txt
Results The first output txt inside all the parameters are printed out, the second and the third TXT file nothing. And then I was anxious about this. I'll find out how to @psboundparameters.
This thing has been looked at. Then suddenly remembered, your sister, not just like a cmdlet to preach, I have written before, rely on, silly fork!
A second error:
The second more tease, I write functions in PowerShell, originally my name and cmdlet do not coincide, the result of a road, thinking of people named multi-standard Ah, I will change the function name to someone else's cmdlet name,
The cmdlet is then called inside. This is hilarious ah, because of recursion, I print the parameters of crazy, down La Ala AH pull not the end, and then I carefully read my Code, logic is right AH!!! I'm more grumpy.
I go to the toilet, eat fruit, suddenly found, incredibly is this problem ... Really want to cry no tears ah, I this day is so grumpy past! Headache, upset ...
Two mistakes in writing PowerShell scripts today