• No results found

Microsoft. Jump Start. M3: Managing Windows Server 2012 by Using Windows PowerShell 3.0

N/A
N/A
Protected

Academic year: 2021

Share "Microsoft. Jump Start. M3: Managing Windows Server 2012 by Using Windows PowerShell 3.0"

Copied!
25
0
0

Loading.... (view fulltext now)

Full text

(1)

Microsoft

®

Jump Start

M3: Managing Windows

Server 2012 by Using

Windows PowerShell 3.0

Rick Claus | Technical Evangelist | Microsoft Ed Liberman | Technical Trainer | Train Signal

(2)

Jump Start Target Agenda | Day One

Day 1 Day 2

Module 1: Installing and Configuring Servers Based on Windows Server 2012

Module 7: Implementing Failover Clustering

Module 2: Monitoring and

Maintaining Windows Server 2012 Module 8: Implementing Hyper-V Module 3: Managing Windows Server

2012 by Using PowerShell 3.0 Module 9: Implementing Failover Clustering with Hyper-V - MEAL BREAK - - MEAL BREAK -

Module 4: Managing Storage for

Windows Server 2012 Module 10: Implementing Dynamic Access Control Module 5: Implementing Network

Services Module 11: Implementing Active Directory Domain Services Module 6: Implementing Direct Access Module 12: Implementing Active

(3)

Module Overview

Overview of Windows PowerShell 3.0

Using PowerShell 3.0 to Manage AD DS

(4)

What Is Windows PowerShell?

An object-based management environment

An engine that enables administrators to:

– Create automation scripts – Perform batch modifications – Access unavailable settings

Provides a foundation upon which the GUI-based

administrative tools of Microsoft can rest:

– Actions can be accomplished in its command-line

console

– Actions can be invoked within GUIs by running

(5)

Windows PowerShell Syntax

Verb Noun Cmdlet

Get EventLog Get-EventLog

Set ExecutionPolicy Set-ExecutionPolicy

New VM New-VM

• Verb-Noun pair naming is as follows:

• Use cmdlet parameters to modify actions and provide

configuration information. Parameters include:

Named. -EventLog System, -UserName John Switch. -Verbose, -Debug, -Confirm

Positional.

Get-EventLog System

Get-EventLog –LogName System

(6)

Cmdlet Aliases

Common Aliases: • cd -> Set-Location • dir -> Get-Child-Item • ls -> Get-Child-Item • copy -> Copy-Item • kill -> Stop-Process • rm -> Remove-Item • type -> Get-Content • help -> Get-Help

You can use aliases for:

• Backward compatibility • Shorten scripts

(7)

DEMO: Using the Windows PowerShell ISE

• In this demonstration, you will use the Windows

(8)

Accessing Help in Windows PowerShell

• To access the Help documentation, run Get-Help or the

alias help followed by the cmdlet name:

• Get-Help has parameters to adjust the amount of help

displayed. The parameters are:

-detailed -examples -full

-online

• Other cmdlets that you can use for accessing help:

Update-Help, Show-Command, Get-Command, and tab completion Get-Help Get-EventLog

(9)

Using Windows PowerShell Modules

Windows PowerShell is extended through modules

• You can import modules by using the Import-Module cmdlet:

Import-Module Hyper-V

• You can list loaded modules by running the following

command: Get-Module

• Modules can be of the following types:

• Script • Binary

(10)

What Is Windows PowerShell Remoting?

• The purpose of Windows PowerShell remoting is to:

 Connect to a remote computer

 Run one or more commands on that computer  Bring those results back to your computer

• The goals of Windows PowerShell remoting are:

 Single-seat administration  Batch administration

 Lightweight administration

• The three ways to use Windows

PowerShell remoting are:  1-to-1 Remoting

 1-to-Many (or Fan-Out) Remoting  Many-to-1 (or Fan-In) Remoting

Local Remote

Run Command

(11)

What Is New in Windows PowerShell 3.0?

Windows PowerShell 3.0 improvements include:

• Over 260 core cmdlets

• Management of all Windows Roles and Features • Windows PowerShell Workflow

• Windows PowerShell Web Access • Scheduled Jobs

• Enhanced Online Help • ISE Autosense

(12)

Using the Active Directory Module for

Windows PowerShell

The Active Directory PowerShell Module included in Windows Server 2012, provides over 130 cmdlets for managing Active Directory objects, such as:

• Computer Accounts • User Accounts • Service Accounts • Groups • Organizational Units • Replication • Trusts

• Central Access Policies • Password Polices

(13)

Using Windows PowerShell Variables

• A variable is a temporary holding place in memory for a

value, object, or collection of objects

• Variables are named, and their names are preceded with a

dollar sign

=

(14)

The Windows PowerShell Pipeline

• Used to connect the output from one cmdlet to the input

of another cmdlet

• The combination of the first cmdlet, pipe, and second

cmdlet makes a pipeline

Get-ADUser –Filter * | Enable-ADAccount

Enable ADAccount Cmdlet Get-ADUser Cmdlet Process Object Pipe

(15)

Options for Formatting Windows PowerShell Output

• Cmdlets for Formatting Output

• Cmdlets for Manipulating Output

Format-Table

(FT) Format-List (FL) Format-Custom (FC)

Measure-Object

(measure) Sort-Object (sort) Select-Object (select) Where-Object (where)

Format-Wide (FW)

(16)

Creating and Running Windows PowerShell Scripts

• Execution policy restricts script execution, the execution policies

include: • Restricted • AllSigned • RemoteSigned • Unrestricted • Bypass

• Scripts are text files with a .ps1 extension

• Scripts contain one or more commands that you want the shell

to execute in order

• Scripts, when run, require a relative or full path to be specified:

.\Get-LatestLogon.ps1

(17)

Using Windows PowerShell Loops and Conditional

Expressions

foreach ($user in $group){

write-host $user ” is in “ $group}

if ($Today.DayOfWeek = “Monday”) {

write-host “Today is Monday”}

while ($i -ne 25) {write-host $i “is not 25”}

for ($i=1; $i < 25; $i++) {

(18)

DEMO: Managing AD DS by Using PowerShell

• In this demonstration, you will manage AD DS by using

(19)

Active Directory Administrative Center Integration

with Windows PowerShell

Allows management of user accounts, computer

accounts, groups, and organizational units

Provides a Windows PowerShell history of all

commands used

(20)

Discussion: The Need for Windows PowerShell for

Server Management

I <3 PS: c:\users\administrator

(21)

What Is Windows PowerShell Web Access?

Internet Windows PowerShell Web Access Gateway Organization Perimeter Network Organization Network Target 1 Target 2 Target n ……….

(22)

What Are Windows PowerShell Jobs?

Background Jobs:

• Enable extended tasks to be performed in the

background

• Perform tasks on a number of remote servers

Scheduled Jobs:

• Registered background jobs that can run on a

schedule

(23)

Introduction to Windows PowerShell Workflow

Enables automating long-running and complex

activities

Enables automating multiple server management

and application provisioning

Enables processes to be resumed, paused, and

restarted

Created by using Windows PowerShell or Visual

Studio Workflow Designer

Windows Server 2012 includes over 60 predefined

(24)

Quick Review

What happens if you try to run an unsigned script

that you have created locally and the execution

policy is set to RemoteSigned?

When a user that is not authorized attempts to

logon to Windows PowerShell Web Access, what

occurs?

(25)

References

Related documents

WINDOWS SERVER 2008 ACTIVE DIRECTORY, CONFIGURING - CONFIGURING AND TROUBLESHOOTING IDENTITY AND ACCESS SOLUTIONS WITH WINDOWS SERVER 2008 ACTIVE DIRECTORY. WINDOWS

So we have now learned how to install Active Directory on Windows Server 2012 from the Active Directory Domain Services Configuration Wizard by tapping or clicking the Promote

Enabling the Windows 2003 Server to Read User Accounts in Active Directory Once you have installed the Windows 2003 server, you must enable it to read the user accounts listed in

On the Select server roles page, select Active Directory Domain Services, and then in the Add Roles and Features Wizard dialog box, click Add Features.. On the Features page,

To make changes to the new user’s account properties, we right click on their name in the user folder and select Properties from the menu.. We type the person’s job

If you think your child may be a victim of the Peter Pan Syndrome, you have two decisions to make:. First, you must decide whether to focus your effort on prevention

En la misma novela, mucho más adelante y sin nombrarla, así ve a Cristeta Mónica, la cocinera de don Juan: “En mis barrios, en mi casa, sin ir más lejos, conozco yo una muchacha

EXCELLENCE EXPERTISE INNOVATION Tuberculosis Infection Prevention in Health Care Settings Jeffrey L.. Levin,