Powershell Flashcards
Describe PowerShell
As an interactive command shell; Windows PowerShell serves as a direct administrator interface for managing Windows systems. As a scripting and administrative programming environment; Windows PowerShell provides a platform for automating systems.”
What is interpretive programming language platform?
A programming language whose programs are not directly executed by the host cpu but rather executed (or said to be interpreted) by a software known as an interpreter.
How is Windows PowerShell different from other scripting languages such as VBScript and Perl?
Windows PowerShell is not about text processing. It’s about object handling!
What is one way that you can combine commands or cmdlets in Windows PowerShell?
Using piplines
How can you use the modularity of cmdlets to perform a specific task?
…
What is required to run PowerShell?
Windows PowerShell uses Microsoft .NET Framework version 2.0 as a foundation.
How the new cmdlets and aliases are invoked?
…
How the aliases are assigned?
…
What relationship b/w .NET Framework and PowerShell?
Windows PowerShell uses Microsoft .NET Framework version 2.0 as a foundation and is a scripting language for .NET object in the same way as VBScript is a scripting language for the COM.
What are the benefits of having Windows PowerShell run on the .NET Framework?
…
What makes PowerShell easier to automate?
Object orientation plus .NET features makes Windows PowerShell easy to automate.
How can you take advantage of the object-oriented nature of Windows PowerShell?
…
What other object-oriented framewords Windows operating system supports besides .NET?
COM and WMI
What other object-oriented framewords can be used by PowerShell?
.NET - COM - WMI
How can you combine .NET
COM, and WMI objects to facilitate your tasks?,
How can PowerShell be extended?
Providers - Cmdlets - Scripts - functions - aliases
What is a cmdlet?
A commandlet (cmdlet) is a lightweight command used in the Windows PowerShell environment.
How does Exchange Management Shell (EMS) improve Windows PowerShell capabilities?
…
What needs to be set to allow scripts to be executed?
set-executionpolicy remotesigned
What version of .NET is installed on Windows 2008 server?
.NET 3.0
Why does PowerShell doesn’t run on Server Core?
.NET Framework doesn’t yet run on Server Core
How PowerShell is installed on Windows 2008 server?
Server Manager via Administrative Tools and select add Feature
Difference b/w Core server and Windows 2008 server?
…
What is the path to Windows PowerShell executables?
c:\windows\system32\WindowsPowerShell\v1.0
Is there a benefit to viewing the installation folder in Windows PowerShell?
…
What is the advantage of associating the .ps1 file extension with Notepad rather than Windows PowerShell?
To avaoid unwanted programs to be executed upon opening the ps1 file.
On which framework and runtime environment is Windows PowerShell based?
…
What is the default installation path of Windows PowerShell?
…
What is the default execution policy security level in Windows PowerShell version 1.0?
…
What are three kinds of objects that Windows PowerShell can work with?
…
How can the objects in Active Directory be managed in a domain controller which is running Core Server
using Windows PowerShell?,
Can the PowerShell scripts be used to manage Windows 2000 server or Windows 2000 Professional?
…
What is an object in PowerShell?
Object in PowerShell have interfaces, methods and properties
Which Framework offers a richer set of examples in which the computer configuration is changed by manipulating objects?
…
What does a method do?
Act on the object
Objects have types and kinds
TRUE
What is an object class?
An object class is the definition of the rules for an object: which properties are allowed. An object class is used as a template. All objects of the same class share similar traits, behaviors, and even some attribute values.
What are cmdlet?
Microsoft provides about 130 building blocks that perform many basic administrative functions; these fundamental tools are called cmdlets.
Get a list of all cmdlet available
Get-command
Display Help
Get-Help
Cmdlets are named using a ———– naming convention?
Verb-Noun
List all cmdlets with verb Add?
Get-Command -Verb Add - Get-Command -Verb Add : Get : New : Remove : Set
Reterive cmdlets with a specific ver or noun respectively!
Two other options for Get-Command are to use the Verb or Noun parameters to retrieve cmdlets with a specific verb or noun respectively.
Reterive a list of processes running
Get-Process
List running process with process id 0 and 5
Get-Process -id 0;5
List running process with a process name called spooler?
Get-Process -name processname1; processname2; ….;processnamen
Get help on Get-Process help command
Get-Help Get-process
Get detailed full help and Examples on Get-Process cmdlet
Get-Help Get-process -[detailed] [full][examples]
List common parameters
Verbos - Debug - ErrorAction - ErrorVariable - OutVariable - OutBuffer
List the common parameters that affect system configuration
WhatIf - Confirm
How does profile help?
Profiles enables you to define aliases in advance
Type the command to view (store) command history
Get-History
Type the command to rerun (invoke) a specific previous command
Invoke-History
Type the command to add items artificially to the history
Add-History
Define: binary module
A Windows PowerShell module whose root module is a binary module file (.dll). A binary module may or may not include a module manifest
Define: cmdlet
A task-oriented command that is used in the Windows PowerShell environment.
Define: common parameter
A parameter that is added to all cmdlets and advanced functions by the Windows PowerShell engine
Define: dot source
to start a command by typing a dot and a space before the command. Commands that are dot sourced run in the current scope instead of in a new scope
Define: dynamic module
A module that exists only in memory. The Import-PSSession cmdlet creates dynamic modules
Define: dynamic parameter
A parameter that is added to a Windows PowerShell cmdlet, function, or script under certain conditions. Cmdlets, functions, providers, and scripts can add dynamic parameters.
Define: formatting file
A Windows PowerShell XML file that has the .format.ps1xml extension and that defines how Windows PowerShell displays an object based on its .NET Framework type.
Define: global session state
The session state that contains the data that is accessible to the user of a Windows PowerShell session
Define: host
The interface that the Windows PowerShell engine uses to communicate with the user
Define: host application
A program that loads the Windows PowerShell engine into its process and uses it to perform operations
Define: input processing method
A method that a cmdlet can use to process the records it receives as input. BeginProcessing, ProcessRecord, EndProcessing, StopProcessing method
Define: manifest module
A Windows PowerShell module that has a manifest and whose ModulesToProcess key is empty
Define: module manifest
A Windows PowerShell data file (.psd1) that describes the contents of a module and that controls how a module is processed
Define: module session state
The session state that contains the public and private data of a Windows PowerShell module
Define: non-terminating error
An error that does not stop Windows PowerShell from continuing to process the command
Define: noun
The word that follows the hyphen in a Windows PowerShell cmdlet name. The noun describes the resources upon which the cmdlet acts
Define: parameter set
A group of parameters that can be used in the same command to perform a specific action
Define: pipe
to send the results of the preceding command as input to the next command
Define: pipeline
A series of commands connected by pipeline operators
Define: PSSession
A type of Windows PowerShell session that is created, managed, and closed by the user
Define: root module
The module specified in the ModuleToProcess key in a module manifest
Define: runspace
the operating environment in which each command in a pipeline is executed
Define: script block
a collection of statements or expressions that can be used as a single unit. A script block can accept arguments and return values
Define: script module
A module whose root module is a script module file (.psm1). A script module may or may not include a module manifest
Define: script module file
A file that contains a Windows PowerShell script. The script defines the members that the script module exports. Script module files have the .psm1 file name extension
Define: shell
The command interpreter that is used to pass commands to the operating system
Define: switch parameter
A parameter that does not take an argument
Define: terminating error
An error that stops Windows PowerShell from processing the command
Define: transaction
An atomic unit of work. The work in a transaction must be completed as a whole; if any part of the transaction fails, the entire transaction fails
Define: types file
A Windows PowerShell XML file that has the .ps1xml extension and that extends the properties of Microsoft .NET Framework types in Windows PowerShell
Define: verb
The word that precedes the hyphen in a Windows PowerShell cmdlet name. The verb describes the action that the cmdlet performs
Define: Windows PowerShell
A command-line shell and task-based scripting technology that provides IT administrators comprehensive control and automation of system administration tasks
Define: Windows PowerShell command
The elements in a pipeline that cause an action to be carried out, either typed at the keyboard or invoked programmatically
Define: Windows PowerShell data file
Text file that has the .psd1 extension. PowerShell uses data files for various purposes such as storing module manifest data and storing translated strings for script internationalization
Define: Windows PowerShell drive
virtual drive that provides direct access to a data store. It can be defined by a Windows PowerShell provider or created at the command line
Define: Windows PowerShell ISE
application that enables you to run commands and to write, test, and debug scripts in a friendly, syntax-colored, Unicode-compliant environment
Define: Windows PowerShell module
self-contained reusable unit that allows you to partition, organize, and abstract your Windows PowerShell code
Define: A PS module can contain:
cmdlets, providers, functions, variables, and other types of resources that can be imported as a single unit
Define: PowerShell provider
.NET Framework-based program that makes the data in a specialized data store available in Windows PowerShell so that you can view and manage it
Define: PowerShell snap-in
resource that defines a set of cmdlets, providers, and Microsoft .NET Framework types that can be added to the Windows PowerShell environment
How would you do the following activity in Powershell: print working directory
pwd
How would you do the following activity in Powershell: who am i
whoami
How would you do the following activity in Powershell: make directory
mkdir
How would you do the following activity in Powershell: change directory
cd
How would you do the following activity in Powershell: list directory
ls
How would you do the following activity in Powershell: remove directory
rmdir
How would you do the following activity in Powershell: push directory
pushd
How would you do the following activity in Powershell: pop directory
popd
How would you do the following activity in Powershell: copy a file or directory
cp
How would you do the following activity in Powershell: robust copy
robocopy
How would you do the following activity in Powershell: move a file or directory
mv
How would you do the following activity in Powershell: page through a file
more
How would you do the following activity in Powershell: print the whole file
type
How would you do the following activity in Powershell: run a command on lots of files
forfiles
How would you do the following activity in Powershell: find files
dir /r
How would you do the following activity in Powershell: find things inside files
select-string
How would you do the following activity in Powershell: read a manual page
help
How would you do the following activity in Powershell: find what man page is appropriate
helpctr
How would you do the following activity in Powershell: print some arguments
echo
How would you do the following activity in Powershell: export/set a new environment variable
set
How would you do the following activity in Powershell: exit the shell
exit
How would you do the following activity in Powershell: DANGER! become super user root DANGER!
runas
How would you do the following activity in Powershell: change permission modifiers
attrib
How would you do the following activity in Powershell: change ownership
iCACLS