 It is Microsoft's new task-based command- line shell and scripting language designed especially for system administration.  It helps Information Technology.

Slides:



Advertisements
Similar presentations
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Advertisements

Lesson 17: Configuring Security Policies
$$ Idea Updatable help system Method overload discovery HelpUri attribute support HelpFile property on FunctionInfo Simplified Where and.
Microsoft PowerShell Tom Roeder CS fa. Motivation.NET as a platform shell web server database access Native access to resources eaiser to manage.
Scripting Automated Solutions for Siemens PLM Software
James Boother Blog: INTRODUCTION TO POWERSHELL.
MIRC Matthew Forest. Introduction mIRC itself is a program designed for text based messaging via the IRC (internet relay chat) protocol. (Link:
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 9: Implementing and Using Group Policy.
Lesson 18: Configuring Application Restriction Policies
Guide To UNIX Using Linux Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Basic.  PS is a command line interpreter/scripting environment  Designed for.Net  Similar to C#  Easy to instantiate.Net classes  Standardized syntax.
Installing Windows XP Professional Using Attended Installation Slide 1 of 41Session 2 Ver. 1.0 CompTIA A+ Certification: A Comprehensive Approach for all.
Welcome Course 20410B Module 0: Introduction Audience
MCTS Guide to Microsoft Windows Server 2008 Network Infrastructure Configuration Chapter 7 Configuring File Services in Windows Server 2008.
1 Chapter Overview Creating User and Computer Objects Maintaining User Accounts Creating User Profiles.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
Module 2 Creating Active Directory ® Domain Services User and Computer Objects.
9.1 © 2004 Pearson Education, Inc. Exam Planning, Implementing, and Maintaining a Microsoft Windows Server 2003 Active Directory Infrastructure.
© 2007 Asynchrony Solutions, Inc. 1 10/29/07 Introduction to PowerShell Brian Button VP Engineering Asynchrony Solutions, Inc
Presenters: Winfred Wangeci Jignash Reddy.  It is Microsoft's new task-based command- line shell and scripting language designed especially for system.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 9: Implementing and Using Group Policy.
MS WINDOWS POWER SHELL CSE 535 Operating Systems.
1 Guide to Novell NetWare 6.0 Network Administration Chapter 12.
Introduction to Shell Script Programming
Hands-On Microsoft Windows Server 2008
Copyright ®xSpring Pte Ltd, All rights reserved Versions DateVersionDescriptionAuthor May First version. Modified from Enterprise edition.NBL.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Microsoft ® Official Course Module XA Using Windows PowerShell ®
PowerShell Basics. o PowerShell is a great way to manipulate server and/or workstation components o It’s geared toward system administrators by creating.
Appendix A Starting Out with Windows PowerShell™ 2.0.
11 MANAGING AND DISTRIBUTING SOFTWARE BY USING GROUP POLICY Chapter 5.
Shell Scripting Introduction. Agenda What is Shell Scripting? Why use Shell Scripting? Writing and Running a Shell Script Basic Commands -ECHO - REM.
Database-Driven Web Sites, Second Edition1 Chapter 5 WEB SERVERS.
Chapter 13 Users, Groups Profiles and Policies. Learning Objectives Understand Windows XP Professional user accounts Understand the different types of.
MCSE Guide to Microsoft Exchange Server 2003 Administration Chapter Two Installing and Configuring Exchange Server 2003.
Section 6: Using Windows PowerShell to Manage Group Policy Introducing Windows PowerShell Windows PowerShell Library for Group Policy Windows PowerShell-Based.
Performing Software Installation with Group Policy Lesson 9.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Good Morning and Thank You!.  Have some Fun!  Learn at least one thing new!  Make myself available to you So please …  Ask questions and enjoy!
POWERSHELL SHENANIGANS KIERAN JACOBSEN HP ENTERPRISE SERVICES.
1 Administering Shared Folders Understanding Shared Folders Planning Shared Folders Sharing Folders Combining Shared Folder Permissions and NTFS Permissions.
Section 11: Implementing Software Restriction Policies and AppLocker What Is a Software Restriction Policy? Creating a Software Restriction Policy Using.
System.Security.Policy namespace Chinmay Lokesh.NET Security CS 795 Summer 2010.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
CN1276 Server Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
Lesson 3: Migrating and Configuring User Data
 Creating and manipulating text has long been one of the primary tasks of scripting languages and  traditional shells. In fact, Perl (the language)
Windows PowerShell Introduction 1 Morgan Simonsen Ementor.
 An alias is an alternative name assigned to a Cmdlet.  Aliases allow users to quickly interact with the shell.  The Cmdlet get-alias is.
MySQL Getting Started BCIS 3680 Enterprise Programming.
CIS 1402: Intro to CIS Tom Gustafson. Facts About PowerShell PowerShell is Microsoft’s command-line interface that provides scripting and management capability.
POWERSHELL BASICS. BACKGROUND  Powershell is a task automation and scripting language based off the.NET framework  It provides the user full access.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
MCSE Guide to Microsoft Exchange Server 2003 Administration Chapter Three Managing Recipients.
Module 14: Advanced Topics and Troubleshooting. Microsoft ® Windows ® Small Business Server (SBS) 2008 Management Console (Advanced Mode) Managing Windows.
 Version 1.0[edit]edit  Version 1.0 was released in 2006 for Windows XP SP2/SP3, Windows Server 2003,
Windows Certification Paths OR MCSA Windows Server 2012 Installing and Configuring Windows Server 2012 Exam (20410) Administering Windows Server.
MySQL Getting Started BCIS 3680 Enterprise Programming.
Ravikanth C.
Introduction to Group Policy Lesson 7. Group Policy Group Policy is a method of controlling settings across your network. – Group Policy consists of user.
PowerShell SUNISH SURENDRAN KANNEMBATH
PowerShell Introduction Copyright © 2016 – Curt Hill.
Exam In The First Attempt?
PowerShell Best Practices for SQL DBA’s
Cmdlets “Command-lets”
Introduction to Group Policy
Presentation transcript:

 It is Microsoft's new task-based command- line shell and scripting language designed especially for system administration.  It helps Information Technology Professionals and PowerShell users control and automate the Administration of the Windows operating system and applications that run on Windows.

 To address recurring needs (Viewing the logged Members )  To run script(s) as a scheduled task ( Running a command when user login or logoff)  To store and share ideas behind the scripts (Creating and modifying files and folders)  Automate repetitive tasks (Automate the user session time)

 Presently, Microsoft Windows programmers have several options when it comes to scripting. They can use: 1.MS-DOS (or CMD) to create simple batch files 2.VBScript for more complex programming 3.PowerShell to make the most of the.NET framework  With one of the above or a combination of all, a programmer gets complete control of all of the objects on a Windows computer.

 A cmdlet is a lightweight command that is used in the Windows PowerShell environment.  Cmdlets follow a verb-noun naming pattern. Examples of verbs: get, set, new Examples of nouns: service, item, date

 Below are sample Cmdlets following the verb- noun naming pattern: PS C:\>get-childitem C:\ (Gets the items and child items in one or more specified locations.) PS C:\>get-service (Retrieve information about the services installed on your computer.) PS C:\>set-location D:\ ( It enables you to specify a new working location.) PS C:\> set-location “c:\my documents”

 Get-Help (get-help set-* gives all cmdlets that start with Set-.)  Get-Command (you’ll get back a list of all the Windows PowerShell cmdlets)  Get-Member (will enumerate the properties and methods of that object.)  Get-Psdrive (Gets the Windows PowerShell drives in the current session)  Format-List (each property is displayed on a separate line)

They differ from commands used in other command-shell environments in that:  They are instances of.NET Framework classes; they are not stand-alone executables.  They can be created from as few as a dozen lines of code.  They do not usually do their own parsing, error presentation, or output formatting. All these are handled by the Windows PowerShell runtime.  They process input objects from the pipeline rather than from streams of text, and cmdlets typically deliver objects as output to the pipeline.  They are record-oriented because they process a single object at a time.

 An alias is an alternative name assigned to a Cmdlet.  Aliases allow users to quickly interact with the shell.  The Cmdlet get-alias is used to list all built- in aliases as shown in the diagram on the next slide:

 They are.NET programs used to provide easy access to information external to the shell environment in order for the users to view it and manage it.  To obtain a listing of all the providers, the Get-PSProvider cmdlet is used.  To work with specific providers, use the set- location cmdlet then specify the provider drive.

 There are seven types of providers namely: 1. Alias - Provides access to the windows PowerShell aliases and their values Get-PSProvider Sl Alias:\ GCI | where-object {$_.name –like “s*”} 2. Environment - Provides access to the Windows environment variables. 3. FileSystem - Provides access to files and directories. 4. Function - Provides access to the functions defined in Windows PowerShell.

5. Registry Provides access to the system registry keys and values. 6. Variable Provides access to Windows PowerShell variables and their values. 7. Certificate Provides read-only access to certificate stores and certificates.

Scripting support is disabled by default in Windows PowerShell. Running a script when policy is not set generates an error message that must be fixed to allow script execution.

 There are four levels of execution policy: 1. Restricted Will not run scripts or configuration files 2. AllSigned All scripts and configuration files must be signed by a trusted publisher 3. RemoteSigned All scripts and configuration files downloaded from the internet must be signed by a trusted publisher 4. Unrestricted All scripts and configuration files will run

 Use the Get-ExecutionPolicy cmdlet to retrieve the current effective script execution policy.  Use the Set-ExecutionPolicy cmdlet to change the script execution policy to unrestricted as shown below: Set-ExecutionPolicy unrestricted

 Running a script can be done either within or outside PowerShell.  Running the script within PowerShell requires the following steps: 1.Type the full path to the script 2.Include the name of the script 3.Ensure you include the PS1 extension C:\mytest\RetrieveAndSortServiceState.PS1

 Running scripts outside PowerShell requires the following steps: 1.Type the full path to the script 2.Include the name of the script 3.Ensure you include the PS1 extension 4.Feed this to the PowerShell.exe program 5.Use the –noexit argument to keep the PowerShell console after script execution Powershell –noexit C:\mytest\RetrieveAndSortServiceState.PS1

Powershell evaluates the condition at the start of each cycle and if it’s true, then it executes the command block as shown in the loop below: $wmi = get-wmiObject win32_processor if ($wmi.Architecture -eq 0) {"This is an x86 computer"} elseif($wmi.architecture -eq 1) {"This is an MIPS computer"} elseif($wmi.architecture -eq 2) {"This is an Alapha computer"} elseif($wmi.architecture -eq 3) {"This is an PowerPC computer"} elseif($wmi.architecture -eq 6) {"This is an IPF computer"} elseif($wmi.architecture -eq 9) {"This is an x64 computer"} else {$wmi.architecture + " is not a cpu type I am familiar with"} "Current clockspeed is : " + $wmi.CurrentClockSpeed + " MHZ" "Max clockspeed is : " + $wmi.MaxClockSpeed + " MHZ" "Current load percentage is: " + $wmi.LoadPercentage + " Percent" "The L2 cache size is: " + $wmi.L2CacheSize + " KB"

 They enable users to write a script that can choose from a series of options without writing a long series of If statements as shown below: $wmi = get-wmiobject win32_computersystem "computer " + $wmi.name + " is: " switch ($wmi.domainrole) { 0 {"`t Stand alone workstation"} 1 {"`t Member workstation"} 2 {"`t Stand alone server"} 3 {"`t Member server"} 4 {"`t Back up domain controller"} 5 {"`t Primary domain controller"} default {"`t The role can not be determined"} }

 Files and Folders New-Item is a quick and easy way to create a new file or folder on your computer. Creating a file: New-Item c:\scripts\new_file.txt - type file Creating a folder: New-Item c:\scripts\Windows PowerShell -type directory

$intFolders = 10 $intPad $i = 1 New-Variable -Name strPrefix -Value "testFolder" -Option constant do { if ($i -lt 10) {$intPad=0 new-item -path c:\mytest -name $strPrefix$intPad$i -type directory} else {new-item -path c:\mytest -name $strPrefix$i -type directory} $i++ }until ($i -eq $intFolders+1)

$intFolders = 10 $intPad $i = 1 New-Variable -Name strPrefix -Value "testFolder" - Option constant do { if ($i -lt 10) {$intPad=0 Remove-item -path c:\mytest\$strPrefix$intPad$i} else {Remove-item -path c:\mytest\$strPrefix$i} $i++ }until ($i -eq $intFolders+1)

 Wilson, E. (2007). Microsoft Windows PowerShell step by step. Washington: Microsoft Press.  Tomsho, G. (2010). MCTS guide to Microsoft Windows Server 2008 Active Directory configuration: Exam Boston, MA: Course Technology/Cengage Learning.  Schwichtenberg, H. (2008). Essential PowerShell. The Addison-Wesley Microsoft technology series. Upper Saddle River, NJ: Addison-Wesley.