Professional Documents
Culture Documents
© 2011 Microsoft Corporation. All Rights Reserved
© 2011 Microsoft Corporation. All Rights Reserved
Microsoft Confidential
Conditions and Terms of Use
Microsoft Confidential
This training package is proprietary and confidential, and is intended only for uses described in the training materials. Content and software
is provided to you under a Non-Disclosure Agreement and cannot be distributed. Copying or disclosing all or any portion of the content
and/or software included in such packages is strictly prohibited.
The contents of this package are for informational and training purposes only and are provided "as is" without warranty of any kind,
whether express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, and non-
infringement.
Training package content, including URLs and other Internet Web site references, is subject to change without notice. Because Microsoft
must respond to changing market conditions, the content should not be interpreted to be a commitment on the part of Microsoft, and
Microsoft cannot guarantee the accuracy of any information presented after the date of publication. Unless otherwise noted, the companies,
organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no
association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should
be inferred.
Part 1
Microsoft Confidential
Meet your trainer
TRAINER_NAME
Premier Field Engineer
Microsoft Services
TRAINER_ALIAS@microsoft.com
3 Microsoft Confidential
alias
Introductions
About You:
Name
Company Affiliation
Title/Function/Area of Responsibility
Product experience
Expectations for this Course
4 Microsoft Confidential
Logistics
5 Microsoft Confidential
Workshop Information
Course Material:
Student Lab Manual
Demonstration Scripts
Hands-On Lab Solutions
Delivery Method:
Slides Demonstration Hands-On
C:\pshell\part1\lesson<n> C:\pshell\part1\lesson<n>\labs
6 Microsoft Confidential
Agenda
Day 1
Lesson 1 | Introduction
Lesson 2 | Commands
Lesson 3 | Pipeline
Lesson 4 | Providers
Day 2
Lesson 5 | Variables and Type Fundamentals
Lesson 6 | Scripting
Lesson 7 | Active Directory Administration (ADSI)
Day 3
Lesson 8 | Active Directory Administration Part 2 (cmdlets)
Lesson 9 | Windows Management Instrumentation
Lesson 10 | Registry, Event Log and ACL Management
Lesson 11 | Remoting
7 Microsoft Confidential
Lesson 1 | Introduction
8 Microsoft Confidential
Lesson 1 | Introduction
What is PowerShell?
What? Why?
Interactive Shell
Object-oriented
New Scripting
Language
Consistent Method
Revolutionary of Administration
9 Microsoft Confidential
Lesson 1 | Introduction
Console & Integrated Scripting Environment (ISE)
Lightweight
Quick
Not as user friendly
10 Microsoft Confidential
Lesson 1 | Introduction
Prerequisites and Installation
Middleware
Operating System
PowerShell v2 Installed By
Default
11 Microsoft Confidential
Lesson 1 | Introduction
Basic PowerShell Commands | Cmdlets
12 Microsoft Confidential
Lesson 1 | Introduction
PowerShell Help
Built-In Help
Cmdlet Help:
Get-Help Get-Command –Full
Get-Help Get-Command –Detailed
Get-Help Get-Command –Examples
13 Microsoft Confidential
Lesson 1 | Introduction
PowerShell Command History
Start-Transcript
Create record of PowerShell session in a text file
start-transcript PowerShell_transcript.txt
stop-transcript
Get-History
Returns last 32 commands
Use $MaximumHistoryCount automatic variable to return last 64
Use Invoke-History to re-run a command
get-history
Invoke-history –id id#
$MaximumHistoryCount
get-history –count $MaximumHistoryCount
14 Microsoft Confidential
Demonstration
Lesson 1 | Introduction
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson1\lesson1-demo.txt
15 Microsoft Confidential
Lab 1 | Introduction (30 minutes)
Scenario
This lab will provide you hands-
on experience with PowerShell
commands.
Goals
Create transcripts of PowerShell
commands
Practice using the top 3 cmdlets
Execute multiple commands in a single
line.
16 Microsoft Confidential
Lesson 2 | Commands
17 Microsoft Confidential
Lesson 2 | Commands
Important Cmdlets
Get-Command Get-Member
Discovers Cmdlets
Gets all properties and methods
of an object.
Get-Command -Verb set
Get-Service | Get-Member
Get-Command –Noun service
Or
Get-Command -Type cmdlet $a = Get-Service
$a | Get-Member
18 Microsoft Confidential
Lesson 2 | Commands
Objects
“An object is a collection of parts and
how to use them”
Parts How to use
Properties Methods
Pedal
Front Wheel
Brake
Back Wheel
Steer Left
Pedals
Steer Right
Saddle
Wheelie
Frame
19 Microsoft Confidential
Lesson 2 | Commands
Object (Service)
Properties Methods
Status Stop()
Pause()
Service
20 Microsoft Confidential
Lesson 2 | Commands
Aliases
Get-Help *alias*
.Net Framework
COM
WMI (Lesson 9)
22 Microsoft Confidential
Lesson 2 | Commands
.Net Framework
VB
PowerShell C#
.Net
.Net Framework
Operating System
Win32 API
23 Microsoft Confidential
Lesson 2 | Commands
Namespaces & Types
24 Microsoft Confidential
Lesson 2 | Commands
Utilising .Net Framework | Instantiate Object
$webClient | Get-Member
25 Microsoft Confidential
Lesson 2 | Commands
Classes & Objects
5 points
Size
Colour
Orientation
26 Microsoft Confidential
Lesson 2 | Commands
Utilising .Net Framework | Classes and Static Members
27 Microsoft Confidential
Lesson 2 | Commands
Utilising .Net Framework | Windows Forms
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms“)
$form = new-object Windows.Forms.Form
$form.Text = “PowerShell Does Indeed Rock"
$button = new-object Windows.Forms.Button
$button.text=“Go On Push Me!"
$button.add_click({$form.close()})
$form.controls.add($button)
$form.Add_Shown({$form.Activate()})
$form.ShowDialog()
28 Microsoft Confidential
Lesson 2 | Commands
Component Object Model (COM)
HKEY_CLASSES_ROOT
29 Microsoft Confidential
Lesson 2 | Commands
Component Object Model (COM) | Instantiate Object
30 Microsoft Confidential
Demonstration
Lesson 2 | Commands
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson2\lesson2-demo.txt
31 Microsoft Confidential
Lab 2 | Commands (30 minutes)
Scenario
This lab will provide you hands-
on experience with PowerShell
commands.
Goals
32 Microsoft Confidential
Lesson 3 | Pipeline
33 Microsoft Confidential
Lesson 3 | Pipeline
Introduction
34 Microsoft Confidential
Lesson 3 | Pipeline
Operators
Arithmetic
Assignment
Comparison
Logical
Redirection
Split/Join
Type
Unary
Special
35 Microsoft Confidential
Lesson 3 | Pipeline
Comparison Operators
Examples:
“PowerShell” –eq “powershell” 4 –gt 4
36 Microsoft Confidential
Lesson 3 | Pipeline
Logical Operators
Examples:
37 Microsoft Confidential
Lesson 3 | Pipeline
Filtering, Sorting, and Grouping data | Display
Get-Process | FL *
38 Microsoft Confidential
Lesson 3 | Pipeline
Filtering, Sorting, and Grouping data | Filtering
39 Microsoft Confidential
Lesson 3 | Pipeline
Filtering, Sorting, and Grouping data | Sort and Group
Sort-Object can be used to sort objects by a specified
property:
Get-Process | Sort-Object -Property WS
40 Microsoft Confidential
Lesson 3 | Pipeline
Input and Output | Text File
41 Microsoft Confidential
Lesson 3 | Pipeline
Input and Output | CSV Files
42 Microsoft Confidential
Demonstration
Lesson 3 | Pipeline
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson3\lesson3-demo.txt
43 Microsoft Confidential
Lab 3 | Pipeline (30 minutes)
Scenario
This lab will provide you hands-
on experience with the
PowerShell pipeline.
Goals
44 Microsoft Confidential
Lesson 4 | Providers
45 Microsoft Confidential
Lesson 4 | Providers
Overview
Default Providers:
Alias, Environment, FileSystem, Function, Registry, Variable, Certificate, WSMan
Consistent Data Store Interaction
Same Cmdlets: New-Item, Remove-Item, Get-Item, Set-Item
Single (items, e.g. Alias) & Multiple (containers & items, e.g. FileSystem)
Level Providers
Consider As ‘Drives’ e.g. C:, Cert:, Function:, etc.
46 Microsoft Confidential
Lesson 4 | Providers
Cmdlets
Get-PSProvider
• List installed providers
Get-PSDrive
• List PowerShell Drive
47 Microsoft Confidential
Demonstration
Lesson 4 | Providers
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson4\lesson4-demo.txt
48 Microsoft Confidential
Lab 4 | Providers (30 minutes)
Scenario
This lab will provide you hands-
on experience with PowerShell
providers.
Goals
49 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
50 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Variables
$MyNum = 32
51 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Variables
PowerShell Constants
Variable whose value cannot be changed once defined
‘Write protected’ variable
52 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Variables | Types
$MyNum.GetType()
Predefined variables
Get-Help about_Automatic_Variables
54 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Strings & Spaces
String
Expandable – double quotes “”
$a = “Hello World!”
$b = “$a” Hello World!
$b
$a = “Hello World!”
$b = ‘$a’ $a
$b
55 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Arrays
56 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Arrays
57 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Arrays | Access Elements
Access array compartments using []
$arrProcesses = Get-Process
$arrProcesses[0].name $arrProcesses[4].name
Index Numbers
$arrProcesses[0] Value of the 1st element
$arrProcesses[-1] Value of the last element in array
Lesson 5 | Variables and Type Fundamentals
Arrays
One-dimensional array:
$arrProcesses = Get-Process
$arrProcesses[0]
Index 0 Index 1 Index 2 Index 3 Index 4
Multi-dimensional array:
$rows = 2
$cols = 2
$arrDim = New-Object 'object[,]' $rows,$cols
$arrDim[0,0]
59 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Hash Tables
Kind of array
Key-Value pair
Dictionary array form
Can access value using a corresponding label
60 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Hash Table
$hash2[“Type3”] = ”Laptop”
61 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Hash Table | Access Elements
62 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Working with Console Input-Output
Writing to Console
Write-Host $a –foregroundcolor “green”
Use either variable name or
Write-Host or
$a
63 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Working with Console Input-Output
Write-Host
Out-GridView
Out-GridView Display output in a Grid view
Writes customized output to a host
Write-Output Sends specified objects to next command in pipeline
Tee-Object Saves command output in a file or variable, and displays it in
the console
64 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Working with Files
Check if file exists:
$Fileinfo = Test-Path C:\Windows\System32\drivers\ntfs.sys
if ($Fileinfo -eq "True") {Write-Host "File Exists"}
Copying files:
Copy-Item C:\setup.log d:\
Moving files:
Move-Item C:\setup.log d:\
65 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
Error Automatic Variables
66 Microsoft Confidential
Lesson 5 | Variables and Type Fundamentals
ErrorActionPreference Variable
67 Microsoft Confidential
Demonstration
PowerShell ISE
C:\pshell\part1\lesson5\lesson5-demo.txt
68 Microsoft Confidential
Lab 5 | Variables and Type Fundamentals
(30 minutes)
Scenario
This lab will provide you hands-
on experience with PowerShell
variables and type fundamentals.
Goals
To use different types of variables for
various operations
To create, modify and understand use of an
array
To create, modify and understand use of a
hash table
69 Microsoft Confidential
Lesson 6 | Scripting
70 Microsoft Confidential
Lesson 6 | Scripting
Security | Execution Policy | Settings
71 Microsoft Confidential
Lesson 6 | Scripting
Security | Execution Policy | Scope
72 Microsoft Confidential
Lesson 6 | Scripting
Security | Execution Policy | Cmdlets
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined • Group Policy
UserPolicy Undefined
Process Undefined • Effective Execution Policy
CurrentUser RemoteSigned
LocalMachine AllSigned
Requires Elevated
Set-ExecutionPolicy remotesigned • Set Policy
PowerShell Session
73 Microsoft Confidential
Lesson 6 | Scripting
Security | Execution Policy | Remote Signed
API
.ps1
To run an unsigned script:
NTFS
74 Microsoft Confidential
Lesson 6 | Scripting
Security | Execution Policy | All Signed | Script Signing
$Cert
Test.ps1
Get-Service
# SIG # Begin signature block
Test.ps1
# MIIEMwYJKoZIhvcNAQcCoIIEJDC
Get-Service
# gjcCAQSgWzBZMDQGCisGAQQBgj
75 Microsoft Confidential
Lesson 6 | Scripting
Running Scripts
76 Microsoft Confidential
Lesson 6 | Scripting
Running Scripts
Set-Executionpolicy remotesigned
77 Microsoft Confidential
Lesson 6 | Scripting
PowerShell Comments
Requires comment:
#requires –version 2
Delimited comment:
<#
Author:
Date:
#>
78 Microsoft Confidential
Lesson 6 | Scripting
Statement Termination
Newline character:
Carriage return character (U+000D)
Line feed character (U+000A)
Carriage return character (U+000D) followed by line feed character
(U+000A)
Semi-colon
;
79 Microsoft Confidential
Lesson 6 | Scripting
Iteration Statements (Loops) $a=1
do
{write-host “Loop:$a”}
Do While while ($a++ -le 5)
While
$a=1
While ($a –lt 10) Do Until
{$a; $a++}
$a=1
Do {$a; $a++}
Until ($a –gt 10)
For
For ($a=1; $a –lt 10; $a++)
{$a}
For Each
Foreach ($i in Get-Childitem c:\windows)
{$i.name}
80 Microsoft Confidential
Lesson 6 | Scripting
Flow Control Statements
Break
Use to exit loop
$counter=0; while ($true)
{if ($counter++ -ge 3) {break} $counter}
Continue
Use to continue a loop (i.e. print $i when divisible by 2)
foreach ($i in 1..10) {If ($i % 2) {Continue} $i}
Return
Return control back to caller of script/function
Optionally return output to console
Exit
Exit current script or shell session
81 Microsoft Confidential
Lesson 6 | Scripting
Other Statements
82 Microsoft Confidential
Lesson 6 | Scripting
Functions
83 Microsoft Confidential
Lesson 6 | Scripting
Scripts | Command Line Arguments
Positional Parameters
$Args
$servername = $args[0]
$username = $args[1] User parameter name directly in script
Param($server, $user)
Write-Host $server
Write-Host $user
84 Microsoft Confidential
Lesson 6 | Scripting
Profiles
Start
PowerShell
Execute Profile
Scripts
Profile 1
Profile 2
Profile 3
PS:/>
85 Microsoft Confidential
Lesson 6 | Scripting
Profile Locations
PowerShell Console
Scope Name
Current User, Current Host $Profile or
$Profile.CurrentUserCurrentHost
Current User, All Hosts $Profile.CurrentUserAllHosts
All Users, Current Host $Profile.AllUsersCurrentHost
All Users, All Hosts $Profile.AllUsersAllHosts
Scope Name
Current User, Current Host $Home\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profil
e.ps1
All Users, Current Host $PsHome\Microsoft.PowerShellISE_profile.ps1
86 Microsoft Confidential
Lesson 6 | Scripting
Dot Sourcing & Script Libraries
87 Microsoft Confidential
Demonstration
Lesson 6 | Scripting
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson6\lesson6-demo.txt
88 Microsoft Confidential
Lab 6 | Scripting (30 minutes)
Scenario
This lab will provide you hands-
on experience with PowerShell
Scripting.
Goals
89 Microsoft Confidential
Lesson 7 | Active Directory Administration (ADSI)
90 Microsoft Confidential
Lesson 7 | AD (ADSI)
DirectoryEntry Class
[System.DirectoryServices.DirectoryEntry] or simply [ADSI]
.put()
.create() .get()
.set() .putex()
.setex()
91 Microsoft Confidential
Lesson 7 | AD (ADSI)
Binding To AD
Alternate credentials:
92 Microsoft Confidential
Lesson 7 | AD (ADSI)
Binding To DC/GC
[ADSI]”GC://DC=contoso,DC=com”
[ADSI]”GC://GC01/DC=contoso,DC=com”
93 Microsoft Confidential
Lesson 7 | AD (ADSI)
Directory Searcher
Bind to AD:
$domain = [ADSI]”LDAP://DC=contoso,DC=com”
“(&(objectCategory=computer)(operatingSystem=Windows Server*))”
94 Microsoft Confidential
Lesson 7 | AD (ADSI)
Organizational Unit Management
Modify $objFinOU=[ADSI]”LDAP://OU=Finance,DC=contoso,DC=com”
$objFinOU.Put("Description", "Test OU")
OU $objFinOU.SetInfo()
95 Microsoft Confidential
Lesson 7 | AD (ADSI)
User Management
$objUser=[ADSI]”LDAP://CN=FinanceUser01,OU=Finance,DC=contoso,DC=com”
Enable $objUser.SetPassword(”P@ssword1”)
User
$objUser.AccountDisabled = $false
$objUser.Setinfo()
Modify $objUser=[ADSI]”LDAP://CN=FinanceUser01,OU=Finance,DC=contoso,DC=com”
$objUser.Put(“samaccountname”,”FinanceUser01”)
User $objUser.SetInfo()
User
$objOU.Delete('User', 'CN=FinanceUser01')
96 Microsoft Confidential
Demonstration
Lesson 7 | AD (ADSI)
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson7\lesson7-demo.txt
97 Microsoft Confidential
Lab 7 | AD (ADSI) (30 minutes)
Scenario
This lab will provide you hands-
on experience administering
Active Directory using
PowerShell and ADSI.
Goals
98 Microsoft Confidential
Lesson 8 | Active Directory Administration
(cmdlets)
99 Microsoft Confidential
Lesson 8 | AD (cmdlets)
AD Module | Overview
Account
User
Computer
Group
OU
Password Policy
Default domain password policy
Fine-grained password policy
Forest & Domain
DC & FSMO
Optional Features
ADWS
Updates
AD DS
Windows 7
RSAT
Windows 2008 AD Module
Windows 2003 SP2
Windows 2003 R2 SP2
Set-location Contoso:
PS Contoso:\> Set-Location 'Contoso:\cn=users,dc=contoso,dc=com'
PS Contoso:\cn=users,dc=contoso,dc=com>
Get-ADComputer -Filter * `
Computer -property name,OperatingSystem,`
Information OperatingSystemServicePack,OperatingSystemVersion `
| Out-GridView
$ITUsers | Remove-ADPrincipalGroupMembership `
Remove -MemberOf "IT“
From Group OR
Remove-ADGroupMember -Identity "IT" -members $ITUsers
$OrignalConfirmPreference = $ConfirmPreference
$ConfirmPreference = "none"
Remove-ADGroupMember -Identity "IT" -members $itusers
$ConfirmPreference = $OrignalConfirmPreference
Example:
OtherTelephone
Multi-valued attribute can contain a single or multiple
values
Each value must be unique
Use Hash Table (Key/Value pair) i.e. @{}
New-ADUser `
-Path "ou=sales,ou=departments,dc=contoso,dc=com" `
-name "Sales1" -SamAccountName "Sales1" `
-UsePrincipalName "Sales1@contoso.com" `
User -department "sales" `
Telephone -OtherAttributes `
Numbers @{otherTelephone="555-555-5555","123-456-7890"}
Lesson 8 | AD (cmdlets)
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson8\lesson8-demo.txt
Goals
Create Users
Modify AD Objects
Search AD
PowerShell
Class Class
No PS required!
PowerShell Admin Remote Machine
PowerShell
WMI Service
Get-WMIObject
DCOM DCOM
Other:
RPC RPC DNS
Permission
TCP/IP TCP/IP
Get-WmiObject
Display WMI namespace & class info
Instantiate WMI class
Example: Use Win32_Service class to display service info
Remove-WmiObject
Delete instance of WMI class
Set-WmiInstance
Creates or updates instance of existing WMI class
Example: Set WMI logging level
Get-WSManInstance
Displays management information for resource instance
Example: Display WinRM listener configuration
Invoke-WmiMethod
Call WMI methods
Allows calling method on instance of class or on the class itself i.e. static
methods
Example: Use Win32_Process create method to launch notepad
Aliases
gwmi
Key Parameters
-namespace, -class, -list, -computername
List Namespaces
Gwmi -Namespace "root" -Class "__NAMESPACE" | Select Name
Properties
BIOSVersion
InstallDate
$bios.BIOSVersion
Key Parameters
-computername, -credential
-ComputerName
Gwmi win32_bios –computername w7client,syddc01,sydsql01
OR
Gwmi win32_bios –computername (Get-Content .\servers.txt)
-Credential
$creds=Get-Credential
Gwmi win32_bios –computername w7client,syddc01 –credential $creds
Lesson 9 | WMI
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson9\lesson9-demo.txt
Goals
Microsoft.Win32.RegistryHive
Retrieve root registry keys
Microsoft.Win32.Registry
Static class members
[Microsoft.Win32.Registry] | gm -static
LocalMachine property:
[Microsoft.Win32.Registry]::localmachine
CurrentUser Property
[Microsoft.Win32.Registry]::currentuser
Instance class members:
$regHKLM = [Microsoft.Win32.Registry]::localmachine
$regHKLM | gm
$regHKLM.GetSubKeyNames()
$regkey=$regHKLM.OpenSubKey("SOFTWARE\Microsoft\Windows\Cur
rentVersion\Run")
[enum]::GetValues(“Microsoft.Win32.RegistryHive”)
ClassesRoot
CurrentUser
LocalMachine
Users
PerformanceData
CurrentConfig
DynData
Properties Methods
ClassesRoot GetValue
CurrentUser SetValue
LocalMachine
[Microsoft.Win32.Registry]::localmachine | Get-Member
Properties Methods
Name GetSubKeyNames
SubKeyCount GetValueNames
ValueCount GetValue
OpenSubKey
$regHKLM = [Microsoft.Win32.Registry]::localmachine
$regHKLM.GetSubKeyNames()
BCD00000000
COMPONENTS
HARDWARE
SAM
SECURITY
SOFTWARE
SYSTEM
Get-WinEvent
New and legacy event log formats
-ComputerName
Limited to reading from event logs
Get-EventLog
Legacy event log formats (2003, XP)
-ComputerName
*EventLog cmdlets for new event logs, etc
New-EventLog -LogName MyEventLog -Source MySource –Computername SYDDC01
System.IO.FileAttributes
Retrieve file & folder attributes
System.IO.FileSystemInfo
Create instance of type to set attributes using instance members
System.IO.FileSystemInfo
Name : debug.txt
Attributes : Archive
$myfile.attributes = “archive”,”readonly”,”hidden”
$myfile | Format-List name,attributes
Name : debug.txt
Attributes : ReadOnly, Hidden, Archive
(Get-ACL c:\PShell\lesson7\debug.txt).access | fl *
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference :
BUILTIN\Administrators
IsInherited : True
InheritanceFlags : None
PropagationFlags : None
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : NT
AUTHORITY\SYSTEM
IsInherited : True
InheritanceFlags : None
PropagationFlags : None
FileSystemRights : 268435456
AccessControlType : Allow
IdentityReference : NT AUTHORITY\SYSTEM
IsInherited : False
InheritanceFlags : ContainerInherit, ObjectInherit
PropagationFlags : InheritOnly
FileSystemRights : FullControl
AccessControlType : Allow
IdentityReference : BUILTIN\Administrators
IsInherited : False
InheritanceFlags : None
PropagationFlags : None
PowerShell ISE
C:\pshell\part1\lesson10\lesson10-demo.txt
Scenario
This lab will provide you hands-
on experience with basic
windows management.
Goals
PowerShell Remoting
Raw WS-Man
(WinRM)
-ComputerName
PowerShell
WMI Cmdlets Remoting
RPC, WS-
DCOM, WMI
LDAP MAN
139 Microsoft Confidential
Lesson 11 | Remoting
WMI
-ComputerName
WS-MAN
PSSession
Get-Process
SOAP
SSL
TCP Port
XML5985
Invoke-Command
One or many machines
Run a command –scriptblock
Run a local script remotely -FilePath
New-PSSession
$s = New-PSSession -ComputerName Billpc
Invoke-Command -Session $s –scriptblock {gps}
Get-PSSession
Enter-PSSession (etsn)
PS C:\> Enter-PSSession -ComputerName Billpc
[Billpc]: PS C:\Windows\system32>
$env:computername
Billpc
Exit-PSSession (exit)
Job1
Job1
Job2
Job2
Job3
Get-Job:
CPU : 849.6282463
Wait-Job
Suppresses the PowerShell prompt until the job is complete
Stop-Job
Remove-Job
The Job must be stopped before it can be removed
Lesson 11 | Remoting
Instructor-led demonstration
PowerShell ISE
C:\pshell\part1\lesson11\lesson11-demo.txt
Goals