Size: px
Start display at page:

Download ""

Transcription

1

2

3

4

5

6

7

8

9

10

11

12

13

14 <# Variables.PS1 Demonstrates the use of Variables #> $Date = Get-Date -uformat %A $Name = Read-Host Please enter your name

15 Write-Host Hello $Name, today is $Date <# Variables.PS1 Demonstrates the use of Variables

16 #> $Global:Date = Get-Date -uformat %A $Global:Name = Read-Host Please enter your name Write-Host Hello $Name, today is $Date <# This is the first line comment This is the second line comment #>

17 <# IllegalFiles.PS1 This script will search a path for file types sansell@rm.com #> Where Gets objects where the property matches { Encloses the filter $_.CommandType The property to be filtered by. Always prefaced by $_. -eq Equals. This could be like (Like) or ne (Does not equal). Other comparison operators are available Cmdlet One of the available property types, the other was Application

18

19

20 [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") #Create Form $form = New-Object System.Windows.Forms.Form $form.text = "A.NET Form" $form.size = New-Object System.Drawing.Size(400,130)

21 #== Instruction Label $InstructionlabelBox = new-object System.Windows.Forms.Label $InstructionlabelBox.Font = new-object System.Drawing.Font("New Times Roman",9,[System.Drawing.FontStyle]::Bold) $InstructionlabelBox.location = new-object System.Drawing.Size(10,10) $InstructionlabelBox.size = new-object System.Drawing.Size(375,20) $InstructionlabelBox.text = "Click the Engage button" $form.controls.add($instructionlabelbox) #== Run Button $RunButton = new-object System.Windows.Forms.Button $RunButton.Location = new-object System.Drawing.Size(10,43) $RunButton.Size = new-object System.Drawing.Size(375,25) $RunButton.Text = "Engage!" $RunButton.Add_Click($Execute) $form.controls.add($runbutton)

22 #== Close Button $cabutton = new-object System.Windows.Forms.Button $cabutton.location = new-object System.Drawing.Size(300,75) $cabutton.size = new-object System.Drawing.Size(85,25) $cabutton.text = "Close" $cabutton.add_click({$form.close()}) $form.controls.add($cabutton) $Execute =

23 { $Message = "This works" $Title = "Error" [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void] [System.Windows.Forms.MessageBox]::Show("$Message","$title") } $Execute = { $Date = Get-Date $Message = "$Date" $Title = "The date and time is:" [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void] [System.Windows.Forms.MessageBox]::Show("$Message","$title") } <# Form - 1- Message Box.PS1 This script will search a path for file types sansell@rm.com v0.1

24 #> $Execute = { $Message = "This works" $Title = "A.NET Message Box" [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void] [System.Windows.Forms.MessageBox]::Show("$Message","$title") } [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") #Create Form $form = New-Object System.Windows.Forms.Form $form.text = "A.NET Form" $form.size = New-Object System.Drawing.Size(400,130) #== Instruction Label $InstructionlabelBox = new-object System.Windows.Forms.Label $InstructionlabelBox.Font = new-object System.Drawing.Font("New Times Roman",9,[System.Drawing.FontStyle]::Bold) $InstructionlabelBox.Location = new-object System.Drawing.Size(10,10) $InstructionlabelBox.size = new-object System.Drawing.Size(375,20) $InstructionlabelBox.Text = "Click the Engage button" $form.controls.add($instructionlabelbox) #== Run Button $RunButton = new-object System.Windows.Forms.Button $RunButton.Location = new-object System.Drawing.Size(10,43) $RunButton.Size = new-object System.Drawing.Size(375,25) $RunButton.Text = "Engage!" $RunButton.Add_Click($Execute) $form.controls.add($runbutton) #== Close Button $cabutton = new-object System.Windows.Forms.Button $cabutton.location = new-object System.Drawing.Size(300,75) $cabutton.size = new-object System.Drawing.Size(85,25) $cabutton.text = "Close" $cabutton.add_click({$form.close()}) $form.controls.add($cabutton)

25 #== Credit Label $CreditLabelBox = new-object System.Windows.Forms.Label $CreditLabelBox.Location = new-object System.Drawing.Size(10,78) $CreditLabelBox.size = new-object System.Drawing.Size(260,20) $CreditLabelBox.Text = "Just messing around with forms - sansell@rm.com" $form.controls.add($creditlabelbox) $form.topmost = $true $form.add_shown({$form.activate()}) $form.showdialog()

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43 <# IllegalFiles.PS1 This script will search a path for file types sansell@rm.com v0.1 #> Get-ChildItem C:\Data Recurse Include *.AVI <# IllegalFiles.PS1 This script will search a path for file types sansell@rm.com v0.1 - Hard coded v0.2 - Path and file type variables added #>

44 $Path = Read-Host "Enter the path you wish to search" $FileType = Read-Host "Enter the file type you want to search for. Example *.txt" Get-ChildItem $Path Recurse Include "$FileType" <# IllegalFiles.PS1 This script will search a path for file types sansell@rm.com v0.1 - Hard coded v0.2 - Path and file type variables added v0.3 - Output sent to log file

45 #> $Path = Read-Host "Enter the path you wish to search" $FileType = Read-Host "Enter the file type you want to search for. (Example *.txt)" $LogName = Get-Date -uformat %d%m%y_%h%m%s $LogPath = Read-Host "Enter the log path" Get-ChildItem $Path Recurse Include "$FileType" Out-File $LogPath\$logName.log <# IllegalFiles.PS1 This script will search a path for file types sansell@rm.com v0.1 - Hard coded v0.2 - Path and file type variables added v0.3 - Output sent to log file #> $Path = Read-Host "Enter the path you wish to search"

46 $FileType = Read-Host "Enter the file type you want to search for. (Example *.txt)" $LogName = Get-Date -uformat %d%m%y_%h%m%s $LogPath = Read-Host "Enter the log path" $ServerName = Hostname $Date = Get-date $Date Out-File $LogPath\$LogName.log $ServerName Out-File $LogPath\$LogName.log -Append Get-ChildItem $Path Recurse Include "$FileType" Out-File $LogPath\$LogName.log - Append

47 # Command to run when the execute button is clicked $Execute =

48 { $Path = $txtpath.text $FileType = $txtfiletype.text $LogName = Get-Date -uformat %d%m%y_%h%m%s $LogPath = $txtlogpath.text $ServerName = Hostname $Date = Get-date $Date Out-File $LogPath\$LogName.log $ServerName Out-File $LogPath\$LogName.log -Append Get-ChildItem $Path Recurse Include "$FileType" Select Directory,Name,Length Out- File $LogPath\$LogName.log -Append } [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") #Create Form $form = New-Object System.Windows.Forms.Form $form.text = "IllegalFiles" $form.size = New-Object System.Drawing.Size(400,350)

49 #== Instruction Label $InstructionlabelBox = new-object System.Windows.Forms.Label $InstructionlabelBox.Font = new-object System.Drawing.Font("New Times Roman",9,[System.Drawing.FontStyle]::Bold) $InstructionlabelBox.Location = new-object System.Drawing.Size(10,10) $InstructionlabelBox.size = new-object System.Drawing.Size(375,40) $InstructionlabelBox.Text = "Enter the Source Path, File Type to search for and the Log Path then click Engage" $form.controls.add($instructionlabelbox) #== Search Path $txtpath = new-object System.Windows.Forms.TextBox $txtpath.location = new-object System.Drawing.Size(110,50) $txtpath.size = new-object System.Drawing.Size(200,30) $form.controls.add($txtpath) $lblpath = new-object System.Windows.Forms.Label $lblpath.location = new-object System.Drawing.Size(10,53) $lblpath.size = new-object System.Drawing.Size(100,20) $lblpath.text = "Search Path:" $form.controls.add($lblpath) #== Run Button $RunButton = new-object System.Windows.Forms.Button $RunButton.Location = new-object System.Drawing.Size(10,143) $RunButton.Size = new-object System.Drawing.Size(375,25) $RunButton.Text = "Engage!" $RunButton.Add_Click($Execute) $form.controls.add($runbutton)

50 $cabutton = new-object System.Windows.Forms.Button $cabutton.location = new-object System.Drawing.Size(300,175) $cabutton.size = new-object System.Drawing.Size(85,25) $cabutton.text = "Close" $cabutton.add_click({$form.close()}) $form.controls.add($cabutton)

51 $PathExists = Test-Path $Path If ($PathExists -eq $False) {$Message = "Search path does not exist, please check path!" $Title = "Error" [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void] [System.Windows.Forms.MessageBox]::Show("$Message","$title") } else{ $LogPathExists = Test-Path $LogPath If ($LogPathExists -eq $False)

52 {$Message = "Log path does not exist, please check path!" $Title = "Error" [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void] [System.Windows.Forms.MessageBox]::Show("$Message","$title") } } <# IllegalFiles.PS1 This script will search a path for file types sansell@rm.com v0.1 - Hard coded v0.2 - Path and file type variables added v0.3 - Output sent to log file v0.4 - Selections added v1.0 -.NET form added. v1.1 - Basic error reporting added #> # Command to run when the execute button is clicked $Execute = { #Variables $Path = $txtpath.text $FileType = $txtfiletype.text $LogName = Get-Date -uformat %d%m%y_%h%m%s $LogPath = $txtlogpath.text $ServerName = Hostname $Date = Get-date $Date Out-File $LogPath\$LogName.log $ServerName Out-File $LogPath\$LogName.log -Append #Basic error reporting $PathExists = Test-Path $Path If ($PathExists -eq $False) {$Message = "Search path does not exist, please check path!" $Title = "Error" [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

53 [void] [System.Windows.Forms.MessageBox]::Show("$Message","$title") } else{ $LogPathExists = Test-Path $LogPath If ($LogPathExists -eq $False) {$Message = "Log path does not exist, please check path!" $Title = "Error" [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [void] [System.Windows.Forms.MessageBox]::Show("$Message","$title") } } #Command Get-ChildItem $Path Recurse Include "$FileType" Select Directory,Name,Length Out- File $LogPath\$LogName.log -Append } [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") #Create Form $form = New-Object System.Windows.Forms.Form $form.text = "IllegalFiles" $form.size = New-Object System.Drawing.Size(400,230) #== Instruction Label $InstructionlabelBox = new-object System.Windows.Forms.Label $InstructionlabelBox.Font = new-object System.Drawing.Font("New Times Roman",9,[System.Drawing.FontStyle]::Bold) $InstructionlabelBox.Location = new-object System.Drawing.Size(10,10) $InstructionlabelBox.size = new-object System.Drawing.Size(375,40) $InstructionlabelBox.Text = "Enter the Source Path, File Type to search for and the Log Path then click Engage" $form.controls.add($instructionlabelbox) #== Search Path $txtpath = new-object System.Windows.Forms.TextBox $txtpath.location = new-object System.Drawing.Size(110,50) $txtpath.size = new-object System.Drawing.Size(200,30) $form.controls.add($txtpath) $lblpath = new-object System.Windows.Forms.Label $lblpath.location = new-object System.Drawing.Size(10,53) $lblpath.size = new-object System.Drawing.Size(100,20) $lblpath.text = "Search Path:" $form.controls.add($lblpath)

54 #== Log Path $txtlogpath = new-object System.Windows.Forms.TextBox $txtlogpath.location = new-object System.Drawing.Size(110,80) $txtlogpath.size = new-object System.Drawing.Size(200,30) $form.controls.add($txtlogpath) $lbllogpath = new-object System.Windows.Forms.Label $lbllogpath.location = new-object System.Drawing.Size(10,83) $lbllogpath.size = new-object System.Drawing.Size(100,20) $lbllogpath.text = "Log Path:" $form.controls.add($lbllogpath) #== File Type $txtfiletype = new-object System.Windows.Forms.TextBox $txtfiletype.location = new-object System.Drawing.Size(110,110) $txtfiletype.size = new-object System.Drawing.Size(80,30) $form.controls.add($txtfiletype) $lblfiletype = new-object System.Windows.Forms.Label $lblfiletype.location = new-object System.Drawing.Size(10,113) $lblfiletype.size = new-object System.Drawing.Size(100,20) $lblfiletype.text = "File Type:" $form.controls.add($lblfiletype) $lblfiletype1 = new-object System.Windows.Forms.Label $lblfiletype1.location = new-object System.Drawing.Size(210,113) $lblfiletype1.size = new-object System.Drawing.Size(150,20) $lblfiletype1.text = "Example: *.txt OR *.exe" $form.controls.add($lblfiletype1) #== Run Button $RunButton = new-object System.Windows.Forms.Button $RunButton.Location = new-object System.Drawing.Size(10,143) $RunButton.Size = new-object System.Drawing.Size(375,25) $RunButton.Text = "Engage!" $RunButton.Add_Click($Execute) $form.controls.add($runbutton) #== Close Button $cabutton = new-object System.Windows.Forms.Button $cabutton.location = new-object System.Drawing.Size(300,175) $cabutton.size = new-object System.Drawing.Size(85,25) $cabutton.text = "Close" $cabutton.add_click({$form.close()}) $form.controls.add($cabutton)

55 #== Credit Label $CreditLabelBox = new-object System.Windows.Forms.Label $CreditLabelBox.Location = new-object System.Drawing.Size(10,178) $CreditLabelBox.size = new-object System.Drawing.Size(260,20) $CreditLabelBox.Text = "IllegalFiles.PS1 v1.1 by sansell@rm.com" $form.controls.add($creditlabelbox) $form.topmost = $true $form.add_shown({$form.activate()}) $form.showdialog()

56 <# OldComputers.PS1 This script will search for computers that have not logged on for x days sansell@rm.com v1.0 #> #Import the Active Directory Module Import-Module ActiveDirectory #Get the current system time $Date = Get-Date #Get the number of days to subtract from the current system time $Days = Read-Host "Enter the number of days since last logon" #Create the $Time variable $Time = $Date.AddDays(-$Days) #Find all computer with a logon time older than $Time and display in a grid Get-ADComputer -Filter * Get-ADObject -Properties LastLogonTimeStamp where{(([datetime]::fromfiletime($_.lastlogontimestamp) - ([system.datetime]$time)).totaldays) -lt 0} select-object Name,@{Name="Last Logon"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}} Out-GridView

57

58

Qlik Sense Cmdlet for PowerShell. Sokkorn CHEAV

Qlik Sense Cmdlet for PowerShell. Sokkorn CHEAV Qlik Sense Cmdlet for PowerShell Sokkorn CHEAV Table of Contents 1. Introduction...2 2. Why this document?...2 3. Tested Environment...2 4. Installation...2 6. Command Test Case...4 6.1 View a list of

More information

Govindaraj Rangan Technology Strategist Microsoft India

Govindaraj Rangan Technology Strategist Microsoft India Govindaraj Rangan Technology Strategist Microsoft India Agenda Introduction to Windows Powershell Scripting with Windows Powershell Working with Objects (WMI, COM,.NET) Scripting Best Practices Agenda

More information

CIS 3260 Sample Final Exam Part II

CIS 3260 Sample Final Exam Part II CIS 3260 Sample Final Exam Part II Name You may now use any text or notes you may have. Computers may NOT be used. Vehicle Class VIN Model Exhibit A Make Year (date property/data type) Color (read-only

More information

Classes in C# namespace classtest { public class myclass { public myclass() { } } }

Classes in C# namespace classtest { public class myclass { public myclass() { } } } Classes in C# A class is of similar function to our previously used Active X components. The difference between the two is the components are registered with windows and can be shared by different applications,

More information

Shell programming. Introduction to Operating Systems

Shell programming. Introduction to Operating Systems Shell programming Introduction to Operating Systems Environment variables Predened variables $* all parameters $# number of parameters $? result of last command $$ process identier $i parameter number

More information

Bourne Shell Reference

Bourne Shell Reference > Linux Reviews > Beginners: Learn Linux > Bourne Shell Reference Bourne Shell Reference found at Br. David Carlson, O.S.B. pages, cis.stvincent.edu/carlsond/cs330/unix/bshellref - Converted to txt2tags

More information

Convertor Binar -> Zecimal Rosu Alin, Calculatoare, An2 Mod de Functionare: Am creat un program, in Windows Form Application, care converteste un

Convertor Binar -> Zecimal Rosu Alin, Calculatoare, An2 Mod de Functionare: Am creat un program, in Windows Form Application, care converteste un Convertor Binar -> Zecimal Rosu Alin, Calculatoare, An2 Mod de Functionare: Am creat un program, in Windows Form Application, care converteste un numar binar, in numar zecimal. Acest program are 4 numericupdown-uri

More information

Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic

Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic Outline 6.1 Test-Driving the Enhanced Inventory Application 6.2 Variables 6.3 Handling the TextChanged

More information

Control Structures. CIS 118 Intro to LINUX

Control Structures. CIS 118 Intro to LINUX Control Structures CIS 118 Intro to LINUX Basic Control Structures TEST The test utility, has many formats for evaluating expressions. For example, when given three arguments, will return the value true

More information

Finding RDP sessions on servers using PowerShell

Finding RDP sessions on servers using PowerShell Finding RDP sessions on servers using PowerShell Have you ever needed to use RDP to get to a server console for some local admin work and then been bounced out because there are already active sessions?

More information

Conditional Control Structures. Dr.T.Logeswari

Conditional Control Structures. Dr.T.Logeswari Conditional Control Structures Dr.T.Logeswari TEST COMMAND test expression Or [ expression ] Syntax Ex: a=5; b=10 test $a eq $b ; echo $? [ $a eq $b] ; echo $? 2 Unix Shell Programming - Forouzan 2 TEST

More information

c122mar413.notebook March 06, 2013

c122mar413.notebook March 06, 2013 These are the programs I am going to cover today. 1 2 Javascript is embedded in HTML. The document.write() will write the literal Hello World! to the web page document. Then the alert() puts out a pop

More information

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1

and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1 Chapter 6 How to code methods and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1 Objectives Applied 1. Given the specifications for a method, write the method. 2. Give

More information

Sub To Srt Converter. This is the source code of this program. It is made in C# with.net 2.0.

Sub To Srt Converter. This is the source code of this program. It is made in C# with.net 2.0. Sub To Srt Converter This is the source code of this program. It is made in C# with.net 2.0. form1.css /* * Name: Sub to srt converter * Programmer: Paunoiu Alexandru Dumitru * Date: 5.11.2007 * Description:

More information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture Stephen Pauwels UNIX Scripting Academic Year 2018-2019 Outline Basics Conditionals Loops Advanced Exercises Shell Scripts Grouping commands into a single file Reusability

More information

Lucrare pentru colocviu de practică

Lucrare pentru colocviu de practică Roman Radu-Alexandru Calculatoare an II Lucrare pentru colocviu de practică Descriere: Aplicatia are ca scop functionalitatea unui decodificator si a unui codificator. Converteste un numar din zecimal

More information

Powershell: Introduction and Practical Uses. Presentation URL:

Powershell: Introduction and Practical Uses. Presentation URL: Powershell: Introduction and Practical Uses Presentation URL: http://bit.ly/2ick4pt HELLO! I am Chris Wieringa CS Lab Manager for Calvin College cwieri39@calvin.edu 2 1. Goals What we will cover today...

More information

BASH Programming Introduction

BASH Programming Introduction BASH Programming Introduction 1. Very simple Scripts Traditional hello world script: echo Hello World A very simple backup script: tar -czf /var/my-backup.tgz /home/me/ 2. Redirection stdout 2 file: ls

More information

PowerShell provider for BizTalk Server 2013

PowerShell provider for BizTalk Server 2013 PowerShell provider for BizTalk Server 2013 Getting started guide version 1.4.0.1 Published: October 2014 Randal van Splunteren http://biztalkmessages.vansplunteren.net Maxime Labelle http://maximelabelle.wordpress.com

More information

Title:[ Variables Comparison Operators If Else Statements ]

Title:[ Variables Comparison Operators If Else Statements ] [Color Codes] Environmental Variables: PATH What is path? PATH=$PATH:/MyFolder/YourStuff?Scripts ENV HOME PWD SHELL PS1 EDITOR Showing default text editor #!/bin/bash a=375 hello=$a #No space permitted

More information

Tutorial 5 Completing the Inventory Application Introducing Programming

Tutorial 5 Completing the Inventory Application Introducing Programming 1 Tutorial 5 Completing the Inventory Application Introducing Programming Outline 5.1 Test-Driving the Inventory Application 5.2 Introduction to C# Code 5.3 Inserting an Event Handler 5.4 Performing a

More information

ListBox. Class ListBoxTest. Allows users to add and remove items from ListBox Uses event handlers to add to, remove from, and clear list

ListBox. Class ListBoxTest. Allows users to add and remove items from ListBox Uses event handlers to add to, remove from, and clear list C# cont d (C-sharp) (many of these slides are extracted and adapted from Deitel s book and slides, How to Program in C#. They are provided for CSE3403 students only. Not to be published or publicly distributed

More information

Virtual DMIS Requirements

Virtual DMIS Requirements Virtual DMIS Requirements A: File Format The following sheet contains a brief explanation of commands that may be used when writing a Virtual DMIS program. Not all of the following is required but is it

More information

Security Considerations

Security Considerations Roger Zander CONSULTANT/ MVP Syliance IT Services GmbH roger@zander.ch / roger.zander@syliance.com Security Considerations Configuration Manager Agenda IIS Settings RequestFilterung Monitoring CM12 Site

More information

Visual Studio.NET enables quick, drag-and-drop construction of form-based applications

Visual Studio.NET enables quick, drag-and-drop construction of form-based applications Visual Studio.NET enables quick, drag-and-drop construction of form-based applications Event-driven, code-behind programming Visual Studio.NET WinForms Controls Part 1 Event-driven, code-behind programming

More information

Boulos Dib September 21, 2011

Boulos Dib September 21, 2011 Boulos Dib September 21, 2011 Independent Consultant Napeague Inc. Software Development since 1983 Few Facts (@boulosdib) First Personal Computer 1980 TRS-80 III First Z80 based product (EPROM based Protocol

More information

Lab 4: Shell scripting

Lab 4: Shell scripting Lab 4: Shell scripting Comp Sci 1585 Data Structures Lab: Tools Computer Scientists Outline 1 2 3 4 5 6 What is shell scripting good? are the duct tape and bailing wire of computer programming. You can

More information

CSC 360 Lab Assignment #6 Spring 2015 Due: March 13, 2015

CSC 360 Lab Assignment #6 Spring 2015 Due: March 13, 2015 CSC 360 Lab Assignment #6 Spring 2015 Due: March 13, 2015 The following are the end-of-chapter Labs from Chapter 7 through Chapter 12 of our textbook. Answer each question or describe the PowerShell command(s)

More information

Operatii pop si push-stiva

Operatii pop si push-stiva Operatii pop si push-stiva Aplicatia realizata in Microsoft Visual Studio C++ 2010 permite simularea operatiilor de introducere si extragere a elementelor dintr-o structura de tip stiva.pentru aceasta

More information

Bash scripting basics

Bash scripting basics Bash scripting basics prepared by Anatoliy Antonov for ESSReS community September 2012 1 Outline Definitions Foundations Flow control References and exercises 2 Definitions 3 Definitions Script - [small]

More information

Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects

Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects 1 Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline 19.1 Test-Driving the Microwave Oven Application 19.2 Designing the Microwave Oven Application 19.3 Adding a New

More information

User-Defined Controls

User-Defined Controls C# cont d (C-sharp) (many of these slides are extracted and adapted from Deitel s book and slides, How to Program in C#. They are provided for CSE3403 students only. Not to be published or publicly distributed

More information

DRA PowerShell Usage and Examples

DRA PowerShell Usage and Examples Contents Binding to an Object Using the DRA ADSI Provider in a PowerShell Script 2 Checking for Errors in a PowerShell Script 2 Creating an Object 2 Deleting an Object 3 Determining the Properties of an

More information

Computer Systems and Architecture

Computer Systems and Architecture Computer Systems and Architecture UNIX Scripting Bart Meyers University of Antwerp August 29, 2012 Outline Basics Conditionals Loops Advanced Exercises Shell scripts Grouping commands into a single file

More information

Linux Bash Shell Scripting

Linux Bash Shell Scripting University of Chicago Initiative in Biomedical Informatics Computation Institute Linux Bash Shell Scripting Present by: Mohammad Reza Gerami gerami@ipm.ir Day 2 Outline Support Review of Day 1 exercise

More information

Active Directory Attacks and Detection Part -II

Active Directory Attacks and Detection Part -II Active Directory Attacks and Detection Part -II #Whoami Working as an Information Security Executive Blog : www.akijosberryblog.wordpress.com You can follow me on Twitter: @AkiJos Key Takeaways How to

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 17: Functional Programming Zheng (Eddy Zhang Rutgers University April 4, 2018 Class Information Homework 6 will be posted later today. All test cases

More information

Inheriting Windows Forms with Visual C#.NET

Inheriting Windows Forms with Visual C#.NET Inheriting Windows Forms with Visual C#.NET Overview In order to understand the power of OOP, consider, for example, form inheritance, a new feature of.net that lets you create a base form that becomes

More information

Shell script. Shell Scripts. A shell script contains a sequence of commands in a text file. Shell is an command language interpreter.

Shell script. Shell Scripts. A shell script contains a sequence of commands in a text file. Shell is an command language interpreter. Shell Scripts A shell script contains a sequence of commands in a text file. Shell is an command language interpreter. Shell executes commands read from a file. Shell is a powerful programming available

More information

The power of PowerShell

The power of PowerShell The power of PowerShell Created by Ryan Woodward North Central Missouri College Table of Contents H R P C U G 1. About me 2. What is PowerShell? 3. Installing/Starting PowerShell 4. PowerShell Basics Variables

More information

this.openfiledialog = new System.Windows.Forms.OpenFileDialog(); this.label4 = new System.Windows.Forms.Label(); this.

this.openfiledialog = new System.Windows.Forms.OpenFileDialog(); this.label4 = new System.Windows.Forms.Label(); this. form.designer.cs namespace final { partial class Form1 { private System.ComponentModel.IContainer components = null; should be disposed; otherwise, false. protected override void Dispose(bool disposing)

More information

Shell Start-up and Configuration Files

Shell Start-up and Configuration Files ULI101 Week 10 Lesson Overview Shell Start-up and Configuration Files Shell History Alias Statement Shell Variables Introduction to Shell Scripting Positional Parameters echo and read Commands if and test

More information

Blank Form. Industrial Programming. Discussion. First Form Code. Lecture 8: C# GUI Development

Blank Form. Industrial Programming. Discussion. First Form Code. Lecture 8: C# GUI Development Blank Form Industrial Programming Lecture 8: C# GUI Development Industrial Programming 1 Industrial Programming 2 First Form Code using System; using System.Drawing; using System.Windows.Forms; public

More information

OPERATING SYSTEMS LAB LAB # 6. I/O Redirection and Shell Programming. Shell Programming( I/O Redirection and if-else Statement)

OPERATING SYSTEMS LAB LAB # 6. I/O Redirection and Shell Programming. Shell Programming( I/O Redirection and if-else Statement) P a g e 1 OPERATING SYSTEMS LAB LAB 6 I/O Redirection and Shell Programming Lab 6 Shell Programming( I/O Redirection and if-else Statement) P a g e 2 Redirection of Standard output/input i.e. Input - Output

More information

bash Execution Control COMP2101 Winter 2019

bash Execution Control COMP2101 Winter 2019 bash Execution Control COMP2101 Winter 2019 Bash Execution Control Scripts commonly can evaluate situations and make simple decisions about actions to take Simple evaluations and actions can be accomplished

More information

COMP 4/6262: Programming UNIX

COMP 4/6262: Programming UNIX COMP 4/6262: Programming UNIX Lecture 12 shells, shell programming: passing arguments, if, debug March 13, 2006 Outline shells shell programming passing arguments (KW Ch.7) exit status if (KW Ch.8) test

More information

DAVE LIDDAMENT INTRODUCTION TO BASH

DAVE LIDDAMENT INTRODUCTION TO BASH DAVE LIDDAMENT INTRODUCTION TO BASH @daveliddament FORMAT Short lectures Practical exercises (help each other) Write scripts LEARNING OBJECTIVES What is Bash When should you use Bash Basic concepts of

More information

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Shell. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong Shell Prof. Jinkyu Jeong (Jinkyu@skku.edu) TA -- Minwoo Ahn (minwoo.ahn@csl.skku.edu) TA -- Donghyun Kim (donghyun.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu

More information

CS211 Programming Practicum Fall 2017

CS211 Programming Practicum Fall 2017 Due: Monday, 11/20/17 at 11:59 pm Can I Get There from Here? Programming Project 6 For this program, you will write a C++ Program to represent a travel network. This travel network will use an array of

More information

namespace Tst_Form { private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components;

namespace Tst_Form { private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components; Exercise 9.3 In Form1.h #pragma once #include "Form2.h" Add to the beginning of Form1.h #include #include For srand() s input parameter namespace Tst_Form using namespace System; using

More information

York University AS/AK/ITEC INTRODUCTION TO DATA STRUCTURES. Midterm Sample I. Examiner: S. Chen Duration: One Hour and 30 Minutes

York University AS/AK/ITEC INTRODUCTION TO DATA STRUCTURES. Midterm Sample I. Examiner: S. Chen Duration: One Hour and 30 Minutes York University AS/AK/ITEC 2620 3.0 INTRODUCTION TO DATA STRUCTURES Midterm Sample I Examiner: S. Chen Duration: One Hour and 30 Minutes This exam is closed textbook(s) and closed notes. Use of any electronic

More information

Essentials for Scientific Computing: Bash Shell Scripting Day 3

Essentials for Scientific Computing: Bash Shell Scripting Day 3 Essentials for Scientific Computing: Bash Shell Scripting Day 3 Ershaad Ahamed TUE-CMS, JNCASR May 2012 1 Introduction In the previous sessions, you have been using basic commands in the shell. The bash

More information

Shell Programming (Part 2)

Shell Programming (Part 2) i i Systems and Internet Infrastructure Security Institute for Networking and Security Research Department of Computer Science and Engineering Pennsylvania State University, University Park, PA Shell Programming

More information

(Refer Slide Time: 01:12)

(Refer Slide Time: 01:12) Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #22 PERL Part II We continue with our discussion on the Perl

More information

Indian Institute of Technology Kharagpur. PERL Part II. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T.

Indian Institute of Technology Kharagpur. PERL Part II. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T. Indian Institute of Technology Kharagpur PERL Part II Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T. Kharagpur, INDIA Lecture 22: PERL Part II On completion, the student will be able

More information

A layman s guide to PowerShell 2.0 remoting. Ravikanth Chaganti

A layman s guide to PowerShell 2.0 remoting. Ravikanth Chaganti A layman s guide to PowerShell 2.0 remoting Ravikanth Chaganti Learn the basics of PowerShell 2.0 remoting, methods of remoting and how to use remoting to manage systems in a datacenter. A layman s guide

More information

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable Basic C++ Overview C++ is a version of the older C programming language. This is a language that is used for a wide variety of applications and which has a mature base of compilers and libraries. C++ is

More information

CS Unix Tools & Scripting

CS Unix Tools & Scripting Cornell University, Spring 2014 1 February 24, 2014 1 Slides evolved from previous versions by Hussam Abu-Libdeh and David Slater A note on awk for (item in array) The order in which items are returned

More information

Linux shell programming for Raspberry Pi Users - 2

Linux shell programming for Raspberry Pi Users - 2 Linux shell programming for Raspberry Pi Users - 2 Sarwan Singh Assistant Director(S) NIELIT Chandigarh 1 SarwanSingh.com Education is the kindling of a flame, not the filling of a vessel. - Socrates SHELL

More information

Flag Quiz Application

Flag Quiz Application T U T O R I A L 17 Objectives In this tutorial, you will learn to: Create and initialize arrays. Store information in an array. Refer to individual elements of an array. Sort arrays. Use ComboBoxes to

More information

Building Powerful Workflow Automation with Cherwell and PowerShell

Building Powerful Workflow Automation with Cherwell and PowerShell Building Powerful Workflow Automation with Cherwell and PowerShell Agenda Welcome & Session Introduction What is PowerShell? PowerShell ISE Commands/Cmd-Lets Operators Variables Flow Control LAB 1 Exploring

More information

Introduction to Linux Basics Part II. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala

Introduction to Linux Basics Part II. Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala Introduction to Linux Basics Part II 1 Georgia Advanced Computing Resource Center University of Georgia Suchitra Pakala pakala@uga.edu 2 Variables in Shell HOW DOES LINUX WORK? Shell Arithmetic I/O and

More information

Lampiran B. Program pengendali

Lampiran B. Program pengendali Lampiran B Program pengendali #pragma once namespace serial using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms;

More information

CSCI 211 UNIX Lab. Shell Programming. Dr. Jiang Li. Jiang Li, Ph.D. Department of Computer Science

CSCI 211 UNIX Lab. Shell Programming. Dr. Jiang Li. Jiang Li, Ph.D. Department of Computer Science CSCI 211 UNIX Lab Shell Programming Dr. Jiang Li Why Shell Scripting Saves a lot of typing A shell script can run many commands at once A shell script can repeatedly run commands Help avoid mistakes Once

More information

CSE 374 Midterm Exam 11/2/15. Name Id #

CSE 374 Midterm Exam 11/2/15. Name Id # Name Id # There are 8 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,

More information

Pupil Name. Year. Teacher. Target Level. Key Stage 3 Self-Assessment Year 9 Python. Spelling Test No 3. Spelling Test No 2. Spelling Test No 1

Pupil Name. Year. Teacher. Target Level. Key Stage 3 Self-Assessment Year 9 Python. Spelling Test No 3. Spelling Test No 2. Spelling Test No 1 Pupil Name Year Teacher Target Level Spelling Test No 1 Spelling Test No 2 Spelling Test No 3 1) 2) 3) 4) 5) 1) 2) 3) 4) 5) 1) 2) 3) 4) 5) Spelling Test No 4 Spelling Test No 5 Spelling Test No 6 1) 2)

More information

Shell Script Example. Here is a hello world shell script: $ ls -l -rwxr-xr-x 1 horner 48 Feb 19 11:50 hello* $ cat hello #!/bin/sh

Shell Script Example. Here is a hello world shell script: $ ls -l -rwxr-xr-x 1 horner 48 Feb 19 11:50 hello* $ cat hello #!/bin/sh Shell Programming Shells A shell can be used in one of two ways: A command interpreter, used interactively A programming language, to write shell scripts (your own custom commands) Shell Scripts A shell

More information

Bash shell programming Part II Control statements

Bash shell programming Part II Control statements Bash shell programming Part II Control statements Deniz Savas and Michael Griffiths 2005-2011 Corporate Information and Computing Services The University of Sheffield Email M.Griffiths@sheffield.ac.uk

More information

;;; Determines if e is a primitive by looking it up in the primitive environment. ;;; Define indentation and output routines for the output for

;;; Determines if e is a primitive by looking it up in the primitive environment. ;;; Define indentation and output routines for the output for Page 1/11 (require (lib "trace")) Allow tracing to be turned on and off (define tracing #f) Define a string to hold the error messages created during syntax checking (define error msg ""); Used for fancy

More information

Python Boot Camp. Day 3

Python Boot Camp. Day 3 Python Boot Camp Day 3 Agenda 1. Review Day 2 Exercises 2.Getting input from the user, Interview Lab 3.Scopes 4.Conditionals, Mood Ring Lab 5.Recursion, Recursion Lab Day 2 Exercises Think Python Ch. 3

More information

Polymorphism. Polymorphism. CSC 330 Object Oriented Programming. What is Polymorphism? Why polymorphism? Class-Object to Base-Class.

Polymorphism. Polymorphism. CSC 330 Object Oriented Programming. What is Polymorphism? Why polymorphism? Class-Object to Base-Class. Polymorphism CSC 0 Object Oriented Programming Polymorphism is considered to be a requirement of any true -oriented programming language (OOPL). Reminder: What are the other two essential elements in OOPL?

More information

Python Programming Exercises 1

Python Programming Exercises 1 Python Programming Exercises 1 Notes: throughout these exercises >>> preceeds code that should be typed directly into the Python interpreter. To get the most out of these exercises, don t just follow them

More information

How to Design Programs

How to Design Programs How to Design Programs How to (in Racket): represent data variants trees and lists write functions that process the data See also http://www.htdp.org/ 1 Running Example: GUIs Pick a fruit: Apple Banana

More information

1. Windows Forms 2. Event-Handling Model 3. Basic Event Handling 4. Control Properties and Layout 5. Labels, TextBoxes and Buttons 6.

1. Windows Forms 2. Event-Handling Model 3. Basic Event Handling 4. Control Properties and Layout 5. Labels, TextBoxes and Buttons 6. C# cont d (C-sharp) (many of these slides are extracted and adapted from Deitel s book and slides, How to Program in C#. They are provided for CSE3403 students only. Not to be published or publicly distributed

More information

Smart Flows. Productivity Suite. Smart Flows

Smart Flows. Productivity Suite. Smart Flows Amadeus Selling Platform Connect Productivity Suite Smart Flows Quick Guide September, 2017 Productivity Suite Get revolutionary and time-saving features, but even more options to further increase productivity.

More information

CSc 520. Principles of Programming Languages 7: Scheme List Processing

CSc 520. Principles of Programming Languages 7: Scheme List Processing CSc 520 Principles of Programming Languages 7: Scheme List Processing Christian Collberg Department of Computer Science University of Arizona collberg@cs.arizona.edu Copyright c 2005 Christian Collberg

More information

Shell Programming (bash)

Shell Programming (bash) Shell Programming Shell Programming (bash) Commands run from a file in a subshell A great way to automate a repeated sequence of commands. File starts with #!/bin/bash absolute path to the shell program

More information

Python lab session 1

Python lab session 1 Python lab session 1 Dr Ben Dudson, Department of Physics, University of York 28th January 2011 Python labs Before we can start using Python, first make sure: ˆ You can log into a computer using your username

More information

BASIC ELEMENTS OF A COMPUTER PROGRAM

BASIC ELEMENTS OF A COMPUTER PROGRAM BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators

More information

UNIX shell scripting

UNIX shell scripting UNIX shell scripting EECS 2031 Summer 2014 Przemyslaw Pawluk June 17, 2014 What we will discuss today Introduction Control Structures User Input Homework Table of Contents Introduction Control Structures

More information

A Brief Introduction to Scheme (II)

A Brief Introduction to Scheme (II) A Brief Introduction to Scheme (II) Philip W. L. Fong pwlfong@cs.uregina.ca Department of Computer Science University of Regina Regina, Saskatchewan, Canada Lists Scheme II p.1/29 Lists Aggregate data

More information

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1 Shell Scripting Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 If we have a set of commands that we want to run on a regular basis, we could write a script A script acts as a Linux command,

More information

LOG ON TO LINUX AND LOG OFF

LOG ON TO LINUX AND LOG OFF EXPNO:1A LOG ON TO LINUX AND LOG OFF AIM: To know how to logon to Linux and logoff. PROCEDURE: Logon: To logon to the Linux system, we have to enter the correct username and password details, when asked,

More information

CSc 520 Principles of Programming Languages. Examining Lists. Constructing Lists... 7: Scheme List Processing

CSc 520 Principles of Programming Languages. Examining Lists. Constructing Lists... 7: Scheme List Processing Constructing Lists CSc 520 Principles of Programming Languages 7: Scheme List Processing Christian Collberg collberg@cs.arizona.edu Department of Computer Science University of Arizona The most important

More information

CS 1101 Exam 3 A-Term 2013

CS 1101 Exam 3 A-Term 2013 NAME: CS 1101 Exam 3 A-Term 2013 Question 1: (55) Question 2: (20) Question 3: (25) TOTAL: (100) You have 50 minutes to complete this exam. You do not need to show templates, but you may receive partial

More information

11 and 12 Arithmetic Sequence notes.notebook September 14, 2017

11 and 12 Arithmetic Sequence notes.notebook September 14, 2017 Vocabulary: Arithmetic Sequence a pattern of numbers where the change is adding or subtracting the same number. We call this the common difference "d". Closed/Explicit Formula a formula for a sequence

More information

Introduction to XQuery. Overview. Basic Principles. .. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar..

Introduction to XQuery. Overview. Basic Principles. .. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar.. .. Fall 2007 CSC 560: Management of XML Data Alexander Dekhtyar.. Overview Introduction to XQuery XQuery is an XML query language. It became a World Wide Web Consortium Recommendation in January 2007,

More information

Command Interpreters. command-line (e.g. Unix shell) On Unix/Linux, bash has become defacto standard shell.

Command Interpreters. command-line (e.g. Unix shell) On Unix/Linux, bash has become defacto standard shell. Command Interpreters A command interpreter is a program that executes other programs. Aim: allow users to execute the commands provided on a computer system. Command interpreters come in two flavours:

More information

Product: DQ Order Manager Release Notes

Product: DQ Order Manager Release Notes Product: DQ Order Manager Release Notes Subject: DQ Order Manager v7.1.29 Version: 1.0 January 20, 2017 Distribution: ODT Customers DQ OrderManager v7.1.29 *** requires db update 20170120 or newer ***

More information

Web Services in.net (2)

Web Services in.net (2) Web Services in.net (2) These slides are meant to be for teaching purposes only and only for the students that are registered in CSE4413 and should not be published as a book or in any form of commercial

More information

The PROFESSIONAL LANDLORD

The PROFESSIONAL LANDLORD P PROMAS The PROFESSIONAL LANDLORD Providing Property Management Solutions for Over 25 Years Purge in Version 6 To do a purge - which deletes old transactions and inactive profiles - you must obtain an

More information

Powershell. Working With Data COMP2101 Fall 2017

Powershell. Working With Data COMP2101 Fall 2017 Powershell Working With Data COMP2101 Fall 2017 Where-Object Collections of objects contain objects we are interested in and often also contain objects we are not interested in Where-Object is designed

More information

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers A Big Step Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Copyright 2006 2009 Stewart Weiss What a shell really does Here is the scoop on shells. A shell is a program

More information

Linux Shell Scripting. Linux System Administration COMP2018 Summer 2017

Linux Shell Scripting. Linux System Administration COMP2018 Summer 2017 Linux Shell Scripting Linux System Administration COMP2018 Summer 2017 What is Scripting? Commands can be given to a computer by entering them into a command interpreter program, commonly called a shell

More information

PowerShell. Scripting in Windows Environments Gergő Ládi

PowerShell. Scripting in Windows Environments Gergő Ládi PowerShell Scripting in Windows Environments 2016.04.03. Gergő Ládi (me@gergoladi.me) About Me MSc Student @ BUTE (BME) Member of KSZK since 2011 Relevant certifications: 2016.04.03. Gergő Ládi (me@gergoladi.me)

More information

CSE 374 Midterm Exam 11/2/15 Sample Solution. Question 1. (10 points) Suppose the following files and subdirectories exist in a directory:

CSE 374 Midterm Exam 11/2/15 Sample Solution. Question 1. (10 points) Suppose the following files and subdirectories exist in a directory: Question 1. (10 points) Suppose the following files and subdirectories exist in a directory:.bashrc.emacs.bash_profile proj proj/data proj/data/dict.txt proj/data/smalldict.txt proj/notes proj/notes/todo.txt

More information

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Scripting Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Adapted from Practical Unix and Programming Hunter College Copyright 2006 2009 Stewart Weiss What a shell

More information

Fundamentals of Leveraging PowerShell

Fundamentals of Leveraging PowerShell Fundamentals of Leveraging PowerShell By Carlos Perez Instructor Carlos Perez (Twitter @carlos_perez) Day job is Director of Reverse Engineering at a security vendor. Microsoft MVP on Cloud and Server

More information

On Premise Multi-Server Support Guide

On Premise Multi-Server Support Guide On Premise Multi-Server Support Guide Copyright 2013 Sage Technologies Limited, publisher of this work. All rights reserved. No part of this documentation may be copied, photocopied, reproduced, translated,

More information

This is the start of the server code

This is the start of the server code This is the start of the server code using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Net; using System.Net.Sockets;

More information