Join Don Jones for an in-depth discussion in this video Write the main code for a function, part of PowerShell 3.0: Scripting and Tool Making.
- Because I took the time earlier…to just test individual commands,…writing the main code for my script,…or my function is going to be pretty easy.…First of all, I'm going to take out…this right host, I don't need that there.…I'm going to to grab all three of these…example commands that I used earlier for testing…and copy them to the clip board.…I'll then paste those inside the process script block.…I'm going to be careful to indent them properly.…
Make sure my formatting stays neat.…One thing I need to do is make sure…that these are no longer querying the local computer…but are rather querying whatever computer…name is in the dollar computer variable.…So I'll add the computer name parameter…to get going on my object.…And I'll need to do that for all three instances.…This is kind of ugly now, everything's…wrapping off to the side of the screen,…so I'm going to take advantage of the fact…that I can hit enter after a pipe character,…but I'm going to indent the next line.…
It's just a visual reminder to me…that this is actually a continuation of line 16.…
Author
Released
4/5/2012Skill Level Advanced
Duration
Views
Related Courses
-
PowerShell 3.0 for Administrators
with Don Jones4h 13m Intermediate -
PowerShell: DrillBits
with Don Jones1h 32m Beginner -
PowerShell: Web Access
with Jason C. Helmick1h 31m Intermediate
-
1. Scripting Overview
-
Understand and use scope7m 7s
-
2. PowerShell Advanced Functions
-
Specify usage for a function2m 31s
-
Create the function skeleton1m 28s
-
Test the completed function4m 25s
-
3. More Capabilities for Advanced Functions
-
4. Handle Errors
-
Handling errors29s
-
-
5. Debugging
-
Debug any errors33s
-
Debug with PSBreakpoints4m 43s
-
-
6. Format Custom Views
-
7. Script and Manifest Modules
-
8. Writing Help
-
Write help30s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Write the main code for a function