设为首页 收藏本站
查看: 2093|回复: 0

PowerShell 3.0 实践(一)Windows 8 中的 PowerShell 3.0

[复制链接]

尚未签到

发表于 2015-5-23 10:30:45 | 显示全部楼层 |阅读模式
  Windows 8 惊艳登场,当Metro界面吸引了无数人的眼球时,其实还有很多特性值得关注,如PowerShell 3.0、Hyper-V 3.0、vhdx、IIS 8等。
  PowerShell 2.0实践系列从本次开始全面转向3.0,体验一下PowerShell 3.0带来的管理方案提升。
  很庆幸PowerGUI Script Editor 可以在Windows 8下安装:官方下载
DSC0000.png
  本系列全部脚本在Windows 8 x64(PowerShell 3.0) + PowerGUI Script Editor 3.0 Free Edition x64 上测试通过
  
  一、PowerShell 3.0概述
  如同PowerShell 2.0内置于Windows 7和 Windows Server 2008 R2,在Build大会上发布的Windows 8 Developer Preview 和 Windows Server 8 Developer Preview也内置了PowerShell 3.0。我安装的Windows 8 Developer Preview x64,快捷键Win + R 打开运行,输入powershell即可打开PowerShell 3.0的命令行:
DSC0001.png
  虽然标题栏还是1.0,但是通过全局变量 $host 可以查看具体版本信息:
DSC0002.png
  
  未安装 Windows 8 的朋友也不必扫兴,微软已经放出了PowerShell 3.0 CTP1的下载,在这里下载:
  需要注意的是操作系统必须为Windows 7 SP1 或 Windows Server 2008 R2 SP1,且需要.NET Framework 4.0。
DSC0003.png
  
  PowerShell 3.0 只是 WMF(Windows Management Framework 3.0,Windows 管理框架)的一部分,WMF 3.0的新特性有:
  英文原文
  1、PowerShell 3.0
  支持 Workflows - 让你可以在命令行就可以操作 Windows Workflow Foundation
  更稳定的 Session - 让你的 Session 可以更加适应不稳定的网络、突然停机的系统、随时重新连接
  计划任务 - 让你从命令行就可以创建、管理 Windows 计划任务
  权限托管 - 让受限的用户可以在特定情况下执行更高权限的脚本
  更简化的语法 - 让脚本看起来更像程序或者更像自然语言
  Cmdlet 发掘 - 改进的自动模块加载可以让你更容易发掘系统中的各种 Cmdlet
  PowerShell ISE插件- 更容易编写脚本命令
  
  2、WMI(Windows Management Instrumentation,Windows管理规范)
  新的开发模型提供者 - 新的开发模型降低了管理成本,移除了对COM的依赖
  新的管理客户端API – 提供标准的公共信息模型(CIM = Common Information Model)操作,允许在Windows上管理*ninx等非Windows操作系统
  
  附注:
  公共信息模型CIM,是一个与具体实现无关的、用于描述管理信息的概念性模型。CIM分为两部分:CIM 规范(CIM Specification)和CIM 模式(CIM Schema)。CIM 规范提供了模型的正式定义,它描述了语言、命名、元模式和到其他管理模型(如SNMP MIB)的映射技术;CIM 模式则给出了实际模型的描述。CIM 模型由核心模型、公共模型和扩展模型三层构成。核心模型是一系列类、连接和属性的集合,该对象组提供了所有管理域通用的基本信息模型;公共模型提供特定管理域的通用信息模型,这些特定的管理域,如系统、应用程序、网络和设备等;扩展模型代表通用模型的特定技术扩展。
  通过CIM 建模,能够得到管理域中实体的抽象和表示,包括它们的属性、操作和关系。这样的模型独立于任何具体的数据库、应用、协议以及平台。因此,CIM 模型要求不同开发商所提供的基于不同平台的应用都采用一种标准的格式来描述管理数据,以使数据能够在多种应用间共享。CIM 采用面向对象的方式构建了一种新的适用于管理系统、网络的结构和概念模型。CIM 建模是一种通用方法。特定管理域的CIM 建模是在核心模型和公共模型的基础上进行扩展。
  总的来说公共信息模型(CIM)是一个标准,定义了一个前后一致的模型,依据这个模型,网络设备、系统和应用程序能显示有关它们自己的信息,并使这些信息能被管理工具利用CIM能描述诸如桌面软件和硬件配置、CPU 封装块的序列号以及某个特殊路由器端口上的流量水平等信息。
  也许CIM有别于以前标准的最重要之处是其表示组成计算机系统或公司网络的不同单元和部件之间关系的能力。DIF主席、Novell的公司设计师Winston Bumpus 称,利用CIM"你能看到这台计算机是否与这个应用 程序连在一起,它是在运行从这台服务器上送出的服务。"他还说,通过跟踪路径和检查一路上每个部件的状态,管理工具就能" 回答我为什么不能送出电子邮件这样的问题了。"
  CIMOM 公共信息模型对象管理器(Common Information Model Object Manager)
  是一个描述操作系统构成单元的对象数据库,为MMC和脚本程序提供了一个访问操作系统构成单元的公共接口。
  
  3、WinRM(Windows Remote Management,Windows 远程管理)
  更稳定的连接 - 更加适应不稳定的网络、突然停机的系统、随时重新连接
  更弹性的连接 - 当连接中断后,可以迅速重新连接
  
  4、PowerShell Web服务
  支持REST形式的Web服务使用开放式数据协议(Open Data Protocol ,OData)远程执行PowerShell脚本,支持Windows和非Windows客户端。
  
  二、Windows Server 8中的PowerShell 3.0新模块
  ADDeploymentWF
  AppLocker
  Appx
  BestPractices
  BitsTransfer
  BranchCache
  CimCmdlets
  ClusterAwareUpdating
  DirectAccessClientComponents
  Dism
  DnsClient
  DnsConfig
  DnsLookup
  DnsNrpt
  FailoverClusters
  
  FileServer
  iSCSI
  KdsCmdlets
  Microsoft.PowerShell.Core
  Microsoft.PowerShell.Diagnostics
  Microsoft.PowerShell.Host
  Microsoft.PowerShell.Management
  Microsoft.PowerShell.Security
  Microsoft.PowerShell.Utility
  Microsoft.WSMan.Management
  MicrosoftiSCSITarget
  MsDtc
  NetAdapter
  NetLbfo
  NetQos
  NetSwitchTeam
  NetTCPIP
  netwnv
  NetworkConnectivityStatus
  NetworkSecurity
  NetworkTransition
  PKIClient
  PrintManagement
  PS_MMAgent
  PSDiagnostics
  PSScheduledJob
  PSWorkflow
  RDManagement
  ScheduledTasks
  SecureBoot
  ServerManager
  ServerManagerShell
  SmbShare
  SmbWitness
  Storage
  TelemetryManagement
  TroubleshootingPack
  TrustedPlatformModule
  UserAccessLogging
  Wdac
  Whea
  
  三、Windows 8 Developer Preview中的PowerShell 3.0的命令与别名
  ac
  asnp
  clc
  cli
  clp
  clv
  compare
  cpi
  cpp
  cvpa
  dbp
  diff
  ebp
  epal
  epcsv
  fc
  fl
  foreach
  %
  ft
  fw
  gal
  gbp
  gc
  gci
  gcm
  gdr
  gcs
  ghy
  gi
  gl
  gm
  gmo
  gp
  gps
  group
  gsv
  gsnp
  gu
  gv
  gwmi
  iex
  ihy
  ii
  ipmo
  iwmi
  ipal
  ipcsv
  measure
  mi
  mp
  nal
  ndr
  ni
  nv
  nmo
  oh
  ogv
  ise
  rbp
  rdr
  ri
  rni
  rnp
  rp
  rmo
  rsnp
  rv
  rwmi
  rvpa
  sal
  sasv
  sbp
  sc
  select
  si
  sl
  swmi
  sleep
  sort
  sp
  saps
  start
  spps
  spsv
  sv
  tee
  where
  ?
  write
  rcsn
  cnsn
  dnsn
  irm
  iwr
  cat
  cd
  clear
  cp
  h
  history
  kill
  lp
  ls
  man
  mount
  md
  mv
  popd
  ps
  pushd
  pwd
  r
  rm
  rmdir
  echo
  cls
  chdir
  copy
  del
  dir
  erase
  move
  rd
  ren
  set
  type
  icm
  clhy
  gjb
  rcjb
  rjb
  sajb
  spjb
  wjb
  sujb
  rujb
  nsn
  gsn
  rsn
  ipsn
  epsn
  etsn
  exsn
  sls
  Add-History
  Add-PSSnapin
  Clear-History
  Connect-PSSession
  Disable-PSRemoting
  Disable-PSSessionConfiguration
  Disconnect-PSSession
  Enable-PSRemoting
  Enable-PSSessionConfiguration
  Enter-PSSession
  Exit-PSSession
  Export-Console
  Export-ModuleMember
  ForEach-Object
  Get-Command
  Get-Help
  Get-History
  Get-Job
  Get-Module
  Get-PSSession
  Get-PSSessionConfiguration
  Get-PSSnapin
  Import-Module
  Invoke-Command
  Invoke-History
  New-Module
  New-ModuleManifest
  New-PSSession
  New-PSSessionConfigurationFile
  New-PSSessionOption
  New-PSTransportOption
  Out-Default
  Out-Host
  Out-Null
  Receive-Job
  Receive-PSSession
  Register-JobEvent
  Register-PSSessionConfiguration
  Remove-Job
  Remove-Module
  Remove-PSSession
  Remove-PSSnapin
  Resume-Job
  Save-Help
  Set-PSDebug
  Set-PSSessionConfiguration
  Set-StrictMode
  Start-Job
  Stop-Job
  Suspend-Job
  Test-ModuleManifest
  Test-PSSessionConfigurationFile
  Unregister-PSSessionConfiguration
  Update-Help
  Wait-Job
  Where-Object
  Add-Computer
  Add-Content
  Checkpoint-Computer
  Clear-Content
  Clear-EventLog
  Clear-Item
  Clear-ItemProperty
  Complete-Transaction
  Convert-Path
  Copy-Item
  Copy-ItemProperty
  Debug-Process
  Disable-ComputerRestore
  Enable-ComputerRestore
  Export-CimCommand
  Get-ChildItem
  Get-ComputerRestorePoint
  Get-Content
  Get-ControlPanelItem
  Get-EventLog
  Get-HotFix
  Get-Item
  Get-ItemProperty
  Get-Location
  Get-Process
  Get-PSDrive
  Get-PSProvider
  Get-Service
  Get-Transaction
  Get-WmiObject
  Invoke-Item
  Invoke-WmiMethod
  Join-Path
  Limit-EventLog
  Move-Item
  Move-ItemProperty
  New-EventLog
  New-Item
  New-ItemProperty
  New-PSDrive
  New-Service
  New-WebServiceProxy
  Pop-Location
  Push-Location
  Register-WmiEvent
  Remove-Computer
  Remove-EventLog
  Remove-Item
  Remove-ItemProperty
  Remove-PSDrive
  Remove-WmiObject
  Rename-Computer
  Rename-Item
  Rename-ItemProperty
  Reset-ComputerMachinePassword
  Resolve-Path
  Restart-Computer
  Restart-Service
  Restore-Computer
  Resume-Service
  Set-Content
  Set-Item
  Set-ItemProperty
  Set-Location
  Set-Service
  Set-WmiInstance
  Show-ControlPanelItem
  Show-EventLog
  Split-Path
  Start-Process
  Start-Service
  Start-Transaction
  Stop-Computer
  Stop-Process
  Stop-Service
  Suspend-Service
  Test-ComputerSecureChannel
  Test-Connection
  Test-Path
  Undo-Transaction
  Use-Transaction
  Wait-Process
  Write-EventLog
  Add-Member
  Add-Type
  Clear-Variable
  Compare-Object
  ConvertFrom-Csv
  ConvertFrom-Json
  ConvertFrom-StringData
  ConvertTo-Csv
  ConvertTo-Html
  ConvertTo-Json
  ConvertTo-Xml
  Disable-PSBreakpoint
  Enable-PSBreakpoint
  Export-Alias
  Export-Clixml
  Export-Csv
  Export-FormatData
  Export-PSSession
  Format-Custom
  Format-List
  Format-Table
  Format-Wide
  Get-Alias
  Get-Culture
  Get-Date
  Get-Event
  Get-EventSubscriber
  Get-FormatData
  Get-Host
  Get-Member
  Get-PSBreakpoint
  Get-PSCallStack
  Get-Random
  Get-TraceSource
  Get-TypeData
  Get-UICulture
  Get-Unique
  Get-Variable
  Group-Object
  Import-Alias
  Import-Clixml
  Import-Csv
  Import-LocalizedData
  Import-PSSession
  Invoke-Expression
  Invoke-RestMethod
  Invoke-WebRequest
  Measure-Command
  Measure-Object
  New-Alias
  New-Event
  New-Object
  New-TimeSpan
  New-Variable
  Out-File
  Out-GridView
  Out-Printer
  Out-String
  Read-Host
  Register-EngineEvent
  Register-ObjectEvent
  Remove-Event
  Remove-PSBreakpoint
  Remove-TypeData
  Remove-Variable
  Select-Object
  Select-String
  Select-Xml
  Send-MailMessage
  Set-Alias
  Set-Date
  Set-PSBreakpoint
  Set-TraceSource
  Set-Variable
  Show-Command
  Sort-Object
  Start-Sleep
  Tee-Object
  Trace-Command
  Unblock-File
  Unregister-Event
  Update-FormatData
  Update-List
  Update-TypeData
  Wait-Event
  Write-Debug
  Write-Error
  Write-Host
  Write-Output
  Write-Progress
  Write-Verbose
  Write-Warning
  Set-AppLockerPolicy
  Get-AppLockerPolicy
  Test-AppLockerPolicy
  Get-AppLockerFileInformation
  New-AppLockerPolicy
  Add-BitsFile
  Remove-BitsTransfer
  Complete-BitsTransfer
  Get-BitsTransfer
  Start-BitsTransfer
  Resume-BitsTransfer
  Set-BitsTransfer
  Suspend-BitsTransfer
  Get-CimInstance
  Get-CimSession
  New-CimSession
  New-CimSessionOption
  Remove-CimSession
  Get-CimAssociatedInstance
  Get-CimClass
  Invoke-CimMethod
  New-CimInstance
  Register-CimIndicationEvent
  Remove-CimInstance
  Set-CimInstance
  Resolve-DnsName
  Resolve-DnsName
  Get-KdsRootKey
  Add-KdsRootKey
  Test-KdsRootKey
  Get-KdsConfiguration
  Set-KdsConfiguration
  Clear-KdsCache
  Get-WinEvent
  Get-Counter
  Import-Counter
  Export-Counter
  New-WinEvent
  Start-Transcript
  Stop-Transcript
  Get-Acl
  Set-Acl
  Get-PfxCertificate
  Get-Credential
  Get-ExecutionPolicy
  Set-ExecutionPolicy
  Get-AuthenticodeSignature
  Set-AuthenticodeSignature
  ConvertFrom-SecureString
  ConvertTo-SecureString
  Disable-WSManCredSSP
  Enable-WSManCredSSP
  Get-WSManCredSSP
  Set-WSManQuickConfig
  Test-WSMan
  Invoke-WSManAction
  Connect-WSMan
  Disconnect-WSMan
  Get-WSManInstance
  Set-WSManInstance
  Remove-WSManInstance
  New-WSManInstance
  New-WSManSessionOption
  New-DtcDiagnosticTransaction
  Complete-DtcDiagnosticTransaction
  Join-DtcDiagnosticResourceManager
  Receive-DtcDiagnosticTransaction
  Send-DtcDiagnosticTransaction
  Start-DtcDiagnosticResourceManager
  Stop-DtcDiagnosticResourceManager
  Undo-DtcDiagnosticTransaction
  New-NetAuthenticationProposal
  New-NetMainModeCryptoProposal
  New-NetQuickModeCryptoProposal
  Get-DAPolicyChange
  Get-AutoEnrollmentPolicy
  Set-AutoEnrollmentPolicy
  Export-Certificate
  Import-Certificate
  Get-Certificate
  Switch-Certificate
  Import-PfxCertificate
  Export-PfxCertificate
  Test-Certificate
  New-CertificateNotificationTask
  Get-CertificateNotificationTask
  Remove-CertificateNotificationTask
  Add-EnrollmentPolicyServer
  Get-EnrollmentPolicyServer
  Remove-EnrollmentPolicyServer
  New-SelfSignedCertificate
  Get-PfxData
  New-JobTrigger
  Add-JobTrigger
  Remove-JobTrigger
  Get-JobTrigger
  Set-JobTrigger
  Enable-JobTrigger
  Disable-JobTrigger
  New-ScheduledJobOption
  Get-ScheduledJobOption
  Set-ScheduledJobOption
  Register-ScheduledJob
  Get-ScheduledJob
  Set-ScheduledJob
  Unregister-ScheduledJob
  Enable-ScheduledJob
  Disable-ScheduledJob
  Import-PSWorkflow
  New-PSWorkflowExecutionOption
  New-JobTrigger
  Add-JobTrigger
  Remove-JobTrigger
  Get-JobTrigger
  Set-JobTrigger
  Enable-JobTrigger
  Disable-JobTrigger
  New-ScheduledJobOption
  Get-ScheduledJobOption
  Set-ScheduledJobOption
  Register-ScheduledJob
  Get-ScheduledJob
  Set-ScheduledJob
  Unregister-ScheduledJob
  Enable-ScheduledJob
  Disable-ScheduledJob
  Confirm-SecureBootUEFI
  Set-SecureBootUEFI
  Get-SecureBootUEFI
  Format-SecureBootUEFI
  Test-SecureBootPolicy
  Repair-SecureBootPolicy
  ConvertFrom-SecureBootPolicy
  Install-SecureBootPolicy
  Get-TroubleshootingPack
  Invoke-TroubleshootingPack
  Get-Tpm
  Initialize-Tpm
  Clear-Tpm
  Unblock-Tpm
  Enable-TpmAutoProvisioning
  Disable-TpmAutoProvisioning
  Import-TpmOwnerAuth
  Set-TpmOwnerAuth
  ConvertTo-TpmOwnerAuth
  
  四、PowerShell 3.0基础命令快速参考
  Connect-PSSession
  ConvertFrom-Json
  ConvertTo-Json
  Disable-PSRemoting
  Disconnect-PSSession
  Export-CimCommand
  Get-ControlPanelItem
  Get-TypeData
  Invoke-RestMethod
  Invoke-WebRequest
  New-PSSessionConfigurationFile
  New-PSTransportOption
  New-WinEvent
  Receive-PSSession
  Register-JobEvent
  Remove-TypeData
  Rename-Computer
  Resume-Job
  Save-Help
  Show-Command
  Show-ControlPanelItem
  Suspend-Job
  Test-PSSessionConfigurationFile
  Unblock-File
  Update-Help
  Connect-PSSession  ALIASES cnsn
  SYNTAX
  Connect-PSSession [-ComputerName]  [-Credential ] [-Authentication
   {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest |
  Kerberos}] [-CertificateThumbprint ] [-Port ] [-UseSSL] [-SessionOption ]
  [-ThrottleLimit ] [-WhatIf] [-Confirm] []
  Connect-PSSession [-Session]  [-SessionOption ] [-ThrottleLimit ] [-WhatIf]
  [-Confirm] []
  Connect-PSSession [-ComputerName]  -InstanceId  [-Credential ] [-Authentication
   {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest |
  Kerberos}] [-CertificateThumbprint ] [-Port ] [-UseSSL] [-SessionOption ]
  [-ThrottleLimit ] [-WhatIf] [-Confirm] []
  Connect-PSSession [-ComputerName]  -Name  [-Credential ] [-Authentication
   {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest |
  Kerberos}] [-CertificateThumbprint ] [-Port ] [-UseSSL] [-SessionOption ]
  [-ThrottleLimit ] [-WhatIf] [-Confirm] []
  Connect-PSSession [-Id]  [-SessionOption ] [-ThrottleLimit ] [-WhatIf] [-Confirm]
  []
  ConvertFrom-Json ALIASES None
  SYNTAX
  ConvertFrom-Json [-InputObject]  []
  ConvertTo-Json ALIASES None
  SYNTAX
  ConvertTo-Json [-InputObject]  [-Depth ] [-Compress] []
  Disable-PSRemoting ALIASES None
  SYNTAX
  Disable-PSRemoting [-Force] [-WhatIf] [-Confirm] []
  Disconnect-PSSession ALIASES dnsn
  SYNTAX
  Disconnect-PSSession [-Session]  [[-SessionOption] ] [[-ThrottleLimit] ]
  [-WhatIf] [-Confirm] []
  
  Disconnect-PSSession [[-SessionOption] ] [[-ThrottleLimit] ] [-InstanceId ]
  [-WhatIf] [-Confirm] []
  
  Disconnect-PSSession [[-ComputerName] ] [[-SessionOption] ] [[-ThrottleLimit] ]
  [-WhatIf] [-Confirm] []
  
  Disconnect-PSSession [[-SessionOption] ] [[-ThrottleLimit] ] [-Name ] [-WhatIf]
  [-Confirm] []
  
  Disconnect-PSSession [-Id]  [[-SessionOption] ] [[-ThrottleLimit] ] [-WhatIf]
  [-Confirm] []
  Export-CimCommand ALIASES None
  SYNTAX
  Export-CimCommand [-CmdletDefinitionPath]  [-OutputModule ] [-Force] [-Encoding ]
  [-TypesPath ] [-FormatPath ] [-HelpPath ] [-UseOldSystemManagementApi] []
  Get-ControlPanelItem ALIASES None
  SYNTAX
  Get-ControlPanelItem [[-Name] ] [-Category ] []
  
  Get-ControlPanelItem -CanonicalName  [-Category ] []
  Get-TypeData ALIASES None
  SYNTAX
  Get-TypeData [[-TypeName] ] []
  Invoke-RestMethod ALIASES  irm
  SYNTAX
  Invoke-RestMethod [-Uri]  [-Method  {Default | Get | Head | Post | Put | Delete | Trace |
  Options}] [-ReturnType  {Detect | Json | Xml}] [-Session ] [-SessionVariable
  ] [-Credential ] [-UseDefaultCredentials] [-CertificateThumbprint ] [-Certificate
  ] [-UserAgent ] [-DisableKeepAlive] [-Timeout ] [-Headers ]
  [-MaximumRedirection ] [-Proxy ] [-ProxyCredential ] [-ProxyUseDefaultCredentials] [-Body
  ] [-ContentType ] [-TransferEncoding ] [-InFile ] [-OutFile ] [-PassThru]
  []
  Invoke-WebRequest ALIASES  iwr
  SYNTAX
  Invoke-WebRequest [-Uri]  [-UseBasicParsing] [-Session ] [-SessionVariable ]
  [-Credential ] [-UseDefaultCredentials] [-CertificateThumbprint ] [-Certificate
  ] [-UserAgent ] [-DisableKeepAlive] [-Timeout ] [-Headers ]
  [-MaximumRedirection ] [-Method  {Default | Get | Head | Post | Put | Delete | Trace |
  Options}] [-Proxy ] [-ProxyCredential ] [-ProxyUseDefaultCredentials] [-Body ]
  [-ContentType ] [-TransferEncoding ] [-InFile ] [-OutFile ] [-PassThru]
  []
  New-PSSessionConfigurationFile ALIASES NONE
  SYNTAX
  New-PSSessionConfigurationFile [-Path]  [-SchemaVersion ] [-Guid ] [-Author ]
  [-CompanyName ] [-Copyright ] [-Description ] [-PowerShellVersion ] [-SessionType
   {Empty | RestrictedRemoteServer | Default}] [-ModulesToImport ] [-AssembliesToLoad
  ] [-VisibleAliases ] [-VisibleCmdlets ] [-VisibleFunctions ]
  [-VisibleProviders ] [-VisibleVariables ] [-AliasDefinitions ]
  [-FunctionDefinitions ] [-VariableDefinitions ] [-EnvironmentVariables ]
  [-TypesToProcess ] [-FormatsToProcess ] [-LanguageMode  {FullLanguage |
  RestrictedLanguage | NoLanguage}] [-ExecutionPolicy  {Unrestricted | RemoteSigned | AllSigned |
  Restricted | Default | Bypass | Undefined}] [-ScriptsToProcess ] []
  New-PSTransportOption
  SYNTAX
  New-PSTransportOption [-MaxIdleTimeout ] [-ProcessIdleTimeout ] [-MaxSessions ]
  [-MaxConcurrentCommandsPerSession ] [-ReservedConcurrentCommandsPerSession ] [-MaxSessionsPerUser ]
  [-MaxMemoryPerSessionMB ] [-MaxProcessesPerSession ] [-MaxConcurrentUsers ] [-IdleTimeout ]
  [-OutputBufferingMode ] []
  New-WinEvent
  SYNTAX
  New-WinEvent [-ProviderName]  [-Id]  [[-Payload] ] [-Version ] [-Force]
  []
  Receive-PSSession ALIASES rcsn
  SYNTAX
  Receive-PSSession [-Session]  [-OutTarget  {Default | Host | Job}] [-JobName ]
  [-WhatIf] [-Confirm] []
  
  Receive-PSSession [[-Id] ] [-OutTarget  {Default | Host | Job}] [-JobName ] [-WhatIf]
  [-Confirm] []
  
  Receive-PSSession [[-ComputerName] ] [-Name ] [-OutTarget  {Default | Host | Job}]
  [-JobName ] [-Credential ] [-Authentication  {Default | Basic |
  Negotiate | NegotiateWithImplicitCredential | Credssp | Digest | Kerberos}] [-CertificateThumbprint ]
  [-Port ] [-UseSSL] [-WhatIf] [-Confirm] []
  
  Receive-PSSession [[-ComputerName] ] [[-InstanceId] ] [-OutTarget  {Default | Host |
  Job}] [-JobName ] [-Credential ] [-Authentication  {Default | Basic
  | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest | Kerberos}] [-CertificateThumbprint ]
  [-Port ] [-UseSSL] [-WhatIf] [-Confirm] []
  
  Receive-PSSession [[-InstanceId] ] [-OutTarget  {Default | Host | Job}] [-JobName ]
  [-WhatIf] [-Confirm] []
  
  Receive-PSSession [-Name ] [-OutTarget  {Default | Host | Job}] [-JobName ] [-WhatIf]
  [-Confirm] []
  Register-JobEvent
  SYNTAX
  Register-JobEvent [-InputJobObject]  [-EventName]  [[-SourceIdentifier] ] [[-Action]
  ] [-MessageData ] [-SupportEvent] [-Forward] []
  Remove-TypeData
  SYNTAX
  Remove-TypeData -TypeData  [-WhatIf] [-Confirm] []
  
  Remove-TypeData [-TypeName]  [-WhatIf] [-Confirm] []
  
  Remove-TypeData [-Path ] [-WhatIf] [-Confirm] []
  Rename-Computer
  SYNTAX
  Rename-Computer [-NewName]  [-ComputerName ] [-PassThru] [-DomainCredential ]
  [-LocalCredential ] [-Force] [-Restart] [-WhatIf] [-Confirm] []
  Resume-Job ALIASES rujb
  SYNTAX
  Resume-Job [-Id]  [-PassThru] [-WhatIf] [-Confirm] []
  
  Resume-Job [-Job]  [-PassThru] [-WhatIf] [-Confirm] []
  
  Resume-Job [[-Name] ] [-PassThru] [-WhatIf] [-Confirm] []
  
  Resume-Job [[-InstanceId] ] [-PassThru] [-WhatIf] [-Confirm] []
  
  Resume-Job [-PassThru] [-State  {NotStarted | Running | Completed | Failed | Stopped | Blocked |
  Suspended | Disconnected | Suspending | Stopping}] [-WhatIf] [-Confirm] []
  
  Resume-Job [-PassThru] [-Filter ] [-WhatIf] [-Confirm] []
  Save-Help
  SYNTAX
  Save-Help [[-DestinationPath] ] [[-UICulture] ] [-Force] []
  
  Save-Help [[-DestinationPath] ] [[-InputObject] ] [[-UICulture] ]
  [-LiteralPath ] [-Force] []
  
  Save-Help [[-DestinationPath] ] [[-Module] ] [[-UICulture] ] [-LiteralPath
  ] [-Force] []
  
  Save-Help [[-UICulture] ] [-LiteralPath ] [-Force] []
  Show-Command
  SYNTAX
  Show-Command [[-Name] ] [-Height ] [-Width ] [-NoCommonParameter] [-NoErrorPopup]
  []
  Show-ControlPanelItem
  SYNTAX
  Show-ControlPanelItem [-Name]  []
  
  Show-ControlPanelItem -CanonicalName  []
  
  Show-ControlPanelItem [[-InputObject] ] []
  Suspend-Job ALIASES sujb
  SYNTAX
  Suspend-Job [-Id]  [-PassThru] [-WhatIf] [-Confirm] []
  
  Suspend-Job [-Job]  [-PassThru] [-WhatIf] [-Confirm] []
  
  Suspend-Job [[-Name] ] [-PassThru] [-WhatIf] [-Confirm] []
  
  Suspend-Job [[-InstanceId] ] [-PassThru] [-WhatIf] [-Confirm] []
  
  Suspend-Job [-PassThru] [-State  {NotStarted | Running | Completed | Failed | Stopped | Blocked |
  Suspended | Disconnected | Suspending | Stopping}] [-WhatIf] [-Confirm] []
  
  Suspend-Job [-PassThru] [-Filter ] [-WhatIf] [-Confirm] []
  Test-PSSessionConfigurationFile
  SYNTAX
  Test-PSSessionConfigurationFile [-Path]  []
  Unblock-File
  SYNTAX
  Unblock-File [-Path]  [-WhatIf] [-Confirm] []
  
  Unblock-File [-LiteralPath]  [-WhatIf] [-Confirm] []
  Update-Help
  SYNTAX
  Update-Help [[-SourcePath] ] [[-UICulture] ] [-LiteralPath ] [-Recurse] [-Force]
  []
  
  Update-Help [[-Module] ] [[-SourcePath] ] [[-UICulture] ] [-LiteralPath ]
  [-Recurse] [-Force] []
  
  Update-Help [[-InputObject] ] [[-SourcePath] ] [[-UICulture] ] [-LiteralPath
  ] [-Recurse] [-Force] []
  
  五、最后写几个命令
  查看目前加载的所有模块:Get-Module –All
DSC0004.png
  
  查看ScheduledTasks模块包含的所有命令:Get-Command –Module ScheduledTasks
DSC0005.png
  
  
  小结:
  Windows 8包含的PowerShell 3.0进行了很大的更新,尤其在Windows Server 8中,几乎所有的管理工作都可以使用PowerShell来完成,甚至一部分管理只能用PowerShell。后续篇章会继续在Windows 8中测试PowerShell 3.0,体验企业级的自动化管理任务。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-69760-1-1.html 上篇帖子: 用shell脚本自动化备份数据库 下篇帖子: shell自动化之端口检测脚本
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表