CN1266 Network Scripting Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+

Slides:



Advertisements
Similar presentations
Michelle Johnston, Firebird Services Ltd
Advertisements

CN2140 Server II (V2) Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
How can MyNursingLab Help? Saves you time Focuses your study Tracks your progress Provides many study resources in one place.
CN1176 Computer Support Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN2180 MS SQL Server Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
CN1266 Network Scripting Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
1 Session-7 CSIT 121 Spring 2006 Lab Demo of NiMo Lesson 3-2 Exercises 1,2,3,4,5,6 (Arithmetic Operators with Program ‘Convert.cpp’) Q&A about operators.
10.1 © 2004 Pearson Education, Inc. Exam Planning, Implementing, and Maintaining a Microsoft Windows Server 2003 Active Directory Infrastructure.
CN1266 Network Scripting Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN1276 Server Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN2140 Server II Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
Java vs. You.
SQL for Data Retrieval. Save your SQL Scripts When working with SQL Management Studio, you should keep saving your scripts as a.sql file to somewhere.
CN1176 Computer Support Kemtis Kunanuraksapong MSIS with Distinction MCT, MCTS, MCDST, MCP, A+
CN1260 Client Operating System Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN1276 Server Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN1260 Client Operating System Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
2010/11 : [1]Building Web Applications using MySQL and PHP (W1)PHP Recap.
CN1176 Computer Support Kemtis Kunanuraksapong MSIS with Distinction MCT, MCTS, MCDST, MCP, A+
CN2140 Server II Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN1276 Server (V3) Kemtis Kunanuraksapong MSIS with Distinction MCT, MCTS, MCDST, MCP, A+
CN1260 Client Operating System Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN1176 Computer Support Kemtis Kunanuraksapong MSIS with Distinction MCT, MCTS, MCDST, MCP, A+
CN2140 Server II Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN2140 Server II Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN1260 Client Operating System Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN1260 Client Operating System Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN2140 Server Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN1176 Computer Support Kemtis Kunanuraksapong MSIS with Distinction MCT, MCTS, MCDST, MCP, A+
Chapter 4 JavaScript and Dynamic Web pages. Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””)
Best Practices for Script Design A PowerShell.org TechSession.
CN1176 Computer Support Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN1276 Server Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN1276 Server Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
Linux Operations and Administration
Introduction to Windows PowerShell DANIEL HIBBERT PRIMER FIELD ENGINEER DMVMUG User Conference 2013 – Reston, VA.
CN2180 MS SQL Server Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN1266 Network Scripting V1.2 Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
PROBLEM SOLVING & ALGORITHMS CHAPTER 5: CONTROL STRUCTURES - SELECTION.
CN2140 Server II Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
Kemtis Kunanuraksapong MSIS with Distinction, A+ MCT, MCTS, MCDST, MCP.
CN2180 MS SQL Server Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
Pseudocode Algorithms Using Sequence, Selection, and Repetition Simple Program Design Third Edition A Step-by-Step Approach 6.
Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN1276 Server Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
SQL for Data Retrieval. Save your SQL Scripts When working with SQL Management Studio, you should keep saving your scripts as a.sql file to somewhere.
CN1266 Network Scripting Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN2180 MS SQL Server Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
 An alias is an alternative name assigned to a Cmdlet.  Aliases allow users to quickly interact with the shell.  The Cmdlet get-alias is.
Department of Electrical and Computer Engineering Introduction to Perl By Hector M Lugo-Cordero August 26, 2008.
INLS 560 – F UNCTIONS Instructor: Jason Carter.
CN1260 Client Operating System Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN2180 Chapter 4 Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
CN2180 Chapter 2 Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
CN1276 Server Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
CN1260 Client Operating System Kemtis Kunanuraksapong MSIS with Distinction MCT, MCITP, MCTS, MCDST, MCP, A+
Agenda Introduction Computer Programs Python Variables Assignment
PowerShell SUNISH SURENDRAN KANNEMBATH
while Repetition Structure
08 | Tools that make changes
Write a Fraction as a Terminating Decimal
Section 2.7 Mean, Median, and Mode.
Presentation transcript:

CN1266 Network Scripting Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+

Agenda Chapter 14: Using Functions to Divide and Conquer Quiz Exercise

First function function GetOsInfo{ ▫$OsInfo = Get-WmiObject Win32_operatingsystem ▫write-host ($osinfo.caption + " " + $osinfo.version) } Getosinfo

Defining parameters function getosinfo ($computername){ ▫$osinfo = get-wmiobject Win32_operatingsystem -computer $computername ▫write-host ($osinfo.caption + " " + $osinfo.version) } $computer = get-content env:computername getosinfo $computer

Defining more than one parameters function greeting ($firstname, $lastname){ ▫write-host ("Hello " + $firstname + " " + $lastname) } greeting "Kemtis" "K."

Defining more than one parameters (2) function greeting{ ($firstname, $lastname) ▫write-host ("Hello " + $firstname + " " + $lastname) } greeting "Kemtis" "K."

Defining more than one parameters (3) function sum([int]$a, [int]$b){ ▫write-host ($a + $b) } sum 1 2

Return value from function function greeting($firstname, $lastname){ ▫return ($firstname + " " + $lastname) } $greet = greeting "Kemtis" "K." $greet += ", how are you?" Write-Host $greet

Return value from function (2) function dirwin{ return Get-ChildItem $env:windir } dirwin

Return value from function (3) To return a set of values ▫function DirWinNames{  $dir = Get-ChildItem $env:windir  foreach ($item in $dir){  Write-Output $item.name  } ▫} ▫$contents = DirWinNames ▫foreach ($item in $contents){  Write-Host $item ▫}

Scope Three scopes: ▫Global scope ▫Script scope ▫Private scope ▫See figure 14-1 on Page 194 ▫Test the script on Page 194  *Define $gs1 in the console then type the rest in ISE*

Watching out for name overlap function scopetest{ $myvar = "Jeremy" Write-Host $myvar } $myvar = "Royski" Write-Host $myvar scopetest

Watching out for name overlap (2) function changename{ $name = "Bradley" } $name = "Jason" Write-Host $name changename Write-Host $name

Watching out for name overlap (3) function changename{ $script:name = "Bradley" } $name = "Jason" Write-Host $name changename Write-Host $name

Create your own Cmdlets See Listing 14-1 on Page 198 – 199 Defining attributes ▫SupportShouldProcess  Enable –confirm and –whatif, which prompts the user before the script makes any changes to the system ▫DefaultParameterSet  Use it to define the dafault paramter to use

Create your own Cmdlets (2) ▫ConfirmImpact  Used to determine when the action should be confirmed by a call to the ShouldProcess method. It will run only if the value is equal to or greater than the value of the shell’s $ConfirmPreference ▫Snapin  To define the name of the snap-in used to register the cmdlet ▫See Table 14-1 on parameters

Three methods of the function Begin{} ▫It will be run once when the function is called Process{} End{} It will be run once when the function terminates

Assignment Grade Checker ▫Write a script to take two inputs from user. (Name and score) ▫Write a function that will determine the grade letter base on the score that user type ▫The function should return the grade letter with a compliment follow by the user name. Then display to the screen ▫If user put 90, the compliment should be “You got an A, Good job! Kemtis”