Основные командлеты windows powershell

Click here to load reader

Post on 02-Jan-2017

251 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

Microsoft Windows PowerShellMicrosoft 3 PowerShell4 Windows PowesShell8 PowerShell8 PowerShell 9 1215 16 20 2125 27 31 .31Out-Default34Out- Format-36 37 39 HTML41 Windows PowerShell43 45 47 48 49 CSV XML 51 CSV-52 CSV-52 XML-53 53, 5454 5758 60 61 64 66 68passThru70Windows Management Instrumentation71 WMI72 WMI72 WMI737576 .7679 WMI79 WMI PowerShell80 WMI81 WMI81 86WQL-87 87WMI ForEach-Object88 Active Directory88 89AD PSDrive89 Windows90 9191 AD91 PowerShell92 92 93 94 96 97 98 99 100 101 102 102 103 WMI104 104 105 107 108 109Windows PowerShell Remoting111WinRM1121-to-1 shell1141-to-Many Remoting115 117 117 120 122Restricted Runspaces123 123 124 !124implicit remoting124 Windows Server 2008 R2125 Windows Server 2008 R2125 127 Server Manager128GPO 128 TroubleshootingPack129BPA 130IIS 131 ( )132 132132135136-137137 138 138 140 140 Strict Mode144 146If.ElseIf..Else146 148Switch150Break150 Switch151For151While-Do-Until152ForEach153 154 155$ErrorActionPreference156 157ErrorAction157 157Trap159Try. Catch161 162162 163 164 164 ISE165165 166 167 169-169 170 171 172 173

Microsoft Windows PowerShellMicrosoft

Windows PowerShell , , , Windows. Windows PowerShell , Microsoft Visual Basic Script Edition (VBScript), , , VBScript . Windows PowerShell Windows . , Windows . , Windows PowerShell , , .Windows PowerShell - . Windows Windows, Microsoft , . , Windows PowerShell, , , . , Windows PowerShell, , - . , Windows PowerShell, , , . PowerShell

Windows PowerShell , , . Windows PowerShell , , , , , , , . Windows PowerShell , . , .

PowerShell ISE (integrated scripting environment), . Windows PowerShell ISE , Windows PowerShell , , . . Windows PowerShell , . (GUI) , , , Windows PowerShell . , GUI , , , GUI. Microsoft, Microsoft Exchange Server 2007 Microsoft Exchange Server 2010, . , , Windows Server, , . , Active Directory Administrative Center Windows Server 2008 R2 , , Windows PowerShell , Windows PowerShell ISE.

GUI Windows PowerShell. Microsoft , , , , GUI. GUI , . Microsoft , GUI , , , . Windows PowerShell Microsoft , : GUI . Windows PowerShell , . , Windows PowerShell Visual Basic Script Edition (VBScript), , VBScript, . Windows PowerShell Windows Management Instrumentation (WMI). , WMI , . Windows PowerShell WMI. - WMI, . , , Windows PowerShell . Windows PowesShellWindows PowerShell v2 Windows Server 2008 R2 Windows 7. Windows Server 2008 R2 Windows PowerShell ISE, . Windows PowerShell v2 Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008. Windows PowerShell v2 Windows Management Framework Core, . http://go.microsoft.com/fwlink/?LinkId=193574 (32- 64-). Windows PowerShell ISE, . Windows PowerShell v2 . Windows Server 2008 with Service Pack 1 Windows Server 2008 with Service Pack 2 Windows Server 2003 with Service Pack 2 Windows Vista with Service Pack 2 Windows Vista with Service Pack 1 Windows XP with Service Pack 3 Windows Embedded POSReady 2009 Windows Embedded for Point of Service 1.1 Windows PowerShell v2 Microsoft .NET Framework 2.0 Service Pack 1; Windows PowerShell ISE Microsoft .NET Framework 3.5 Service Pack 1. , Windows PowerShell Microsoft .NET Framework. Framework, . Windows PowerShell Windows. , Windows , . PowerShellWindows PowerShell , Microsoft Management Console (MMC). , , MMC . , , . , , Exchange Server. Windows PowerShell . , , . Windows PowerShell ; , , . , Windows PowerShell Active Directory Domain Services, . Active Directory Domain Services. Windows Remote Server Administration Toolkit (RSAT), , , , , Windows 7. . , CodePlex Web (www.codeplex.com) , Windows PowerShell . . , , Windows PowerShell Community Extensions, www.codeplex.com/powershellcx. , Windows PowerShell . , Windows Microsoft .NET Framework. , . PowerShell Windows PowerShell , , . PowerShell .Windows PowerShell , , , Cmd.exe , Windows, Unix. , , , .

, cmd Unix shell: . . . . . . . .

Windows PowerShell , : Ipconfig.exe Ping.exe Tracert.exe Nslookup.exe Pathping.exe Net.exe (, Net Use)Windows PowerShell , , , , Cd, Dir, Ls, Cat, Type, MkDir, RmDir, Rm, Del, Cp, Copy, Move . file-and-folder Cmd.exe ( MS-DOS ) Unix. , , . , Cmd.exe :Dir /s Windows PowerShell, , / , . , . , Ipconfig.exe, Pathping.exe, , . , , Windows PowerShell:Ipconfig / all , Ipconfig.exe , , Dir . Cmd.exe. , , , , , . Windows , , . , , , , , , . , , , , .

Windows , : Cd, Dir, Copy, Move . Windows. , , Active Directory . Windows (-) , . Windows PowerShell . , , ? , , , , ? , , Windows PowerShell, PSDrive . , Windows PowerShell . , Cd Dir, , , .

Windows PowerShell , : , , , , , , . . IIS, SQL Server, Active Directory . . PSDrives Windows PowerShell Drives. Windows Explorer , , . , HKCU: HKLM:. , , , , , , , , . , , ; .

PSDrives:Get-PSDrive: . , .New-PSDrive: . ( ), . . Remove-PSDrive: . , , HKCU: ENV:, . , , Dir, Cd, Ls, Copy, Rm Windows PowerShell. () . , , , , , . , Dir Get-ChildItem. Ls , Gci. . . Windows PowerShell . , Ipconfig.exe : : - (). . . : ChildItem ChildItems, PSDrive PSDrives. , . .NET Framework, , Visual Basic C# .NET Framework .dll. PSSnapin. ; , . , Dir , , Dir /s : Dir, Get-ChildItem, Dir . , Windows PowerShell. , , . Windows PowerShell ALIAS:, . , : , . . . , .

, : Get-Alias . Dir Alias: ALIAS: drive. New-Alias . , , . Del Rm ALIAS: drive. Import-Alias Export-Alias . (GUI) . , , : , , , , , . , . . , . Windows PowerShell, , , , . . Microsoft . Help, , . , , , ( , , ). , Type, Cat, Del. Unix, Man Help .

Help : -detailed -examples -full , , -online Microsoft. , ., Get-ChildItem, Help gci full. , , , . . , , . , . , . example Help. , ... ; . , , . , , . , Windows PowerShell . , . . , , . :-Recurse , (, ) :-Exclude . , , , : PS C:\> new-aduser cmdlet New-ADUser at command pipeline position 1 Supply values for the following parameters: Name: , : [-Include ] string[], , . , . , , , . , :[-Exclude ] , , . , :-Exclude "*.dll" , . :[-Path] , , (). , LiteralPath, :Get-ChildItem *.* , full help: -Path Specifies a path to one or more locati Required? false Position? 1 Default value Accept pipeline input? true (ByV Accept wildcard characters? false , . , Windows PowerShell , . , , computerName, comp, c, , c. , , . Microsoft, , , PSDrive, . , PSSnapin: Get-PSSnapin Add-PSSnapin Remove-PSSnapin

, , , . ( , ), : Get-PSSnapin registered Get-PSSnapin . , , , , . Windows PowerShell : Import-Module Remove-Module Get-Module , : Get-Module list Windows PowerShell . , , : Type Env:\PSModulePath , , . , , , . . , . , Cmd.exe: Dir | More Dir More, . Windows PowerShell. , . , , , .

Windows PowerShell , Windows Unix. . , . Shell . , , . , . , .

, (|) . , , : Get-Process | Format-List . . , , : Import-CSV c:\new_users.csv | New-ADUser passThru | Enable-ADAccount. Active Directory . ; Windows PowerShell , (, , ).

Windows PowerShell , , , . Unix - , Windows ( , Cmd.exe) . , , . , , Plist , : Pid Name Image --- ------------------------- ------------- 092 Notepad notepad.exe 098 Windows Paint mspaint.exe 112 Calculator calc.exe 164 Windows