Frage

I am unclear what the benefits of snippets are, but I was going to publish a script I wrote to TechNet. I finish all the entries and the page tells me: A contribution to the TechNet Script Center Repository must contain a code snippet. Is the PowerShell code not enough? I tried creating snippets in ISE but seems more work than necessary.

Here is the code I put which isn't much at all:

$computers = "<TextFileListofComputerToRunViaPoSh.txt>"

$ADComp = "<OutputFileLocation.txt/.Log>"

Get-Content $computers | Foreach {If (Get-ADComputer -Filter {Name -eq $_}) {Add-Content $ADComp "$_ is Enabled $((Get-ADComputer $_).enabled) in Active Directory."} Else {Add-Content $ADComp "Warning!! $_ is not in Active Directory."}}

I noticed there was an insert code section and copying code there allowed me to save and publish my code.

War es hilfreich?

Lösung

There is an Insert Code Button which I used to put in my code. After I added code, I did not need to use snippets. My intent was to merely publish my script, not to snippet the work I had done.

Andere Tipps

If it's relatively simple/short, just post the code there. If it a module or function, post an example or two of calling the function or using the functions or cmdlets from the module. Look at some of the other submissions for ideas.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top