Windows Server 2008
description
Transcript of Windows Server 2008
1/41
Windows Server 2008
曹祖聖台灣微軟資深講師[email protected]://teacher.syset.comMCP, MCP+I, MCSA, MCSE,MCDBA, MCAD, MCSD, MCT, MVP
2/41
Server Manager
作業系統安裝
初始化組態設定
伺服器管理
3/41
DEMO
4/41
什麼是 Windows PowerShell ?
微軟的一個新的 Windows 與伺服器管理平台整個平台上的管理功能會不斷的增加是一個互動式的命令列環境全部物件化的腳本指令 …只有 Windows 平台上才有 !
5/41
Windows Server 功能
圖形介面管理工具( 例如 : MMC 嵌入式管理單元 )
命令列工具 Component Object Model (COM) 元件 WMI 類別
過去的管理架構
6/41
Windows Server 功能
Microsoft .NET Framework
Windows PowerShell Cmdlets
MMC 嵌入式管理單元 指令碼其它
新一代的管理架構
7/41
Windows PowerShell
支援現有的技術 :Windows Management Instrumentation (WMI)Active Directory Services Interface (ADSI)Microsoft .NET Framework 與 COM
相容性 :現有的命令列工具 100% 可以用
這表示你可以延用先前的技術,而且更方便、功能更強大
8/41
Cmdlet 與參數
ComletCmdlet 是 PowerShell 中的 " 指令 "是使用 .NET Framework 程式語言所撰寫出來的類別( Visual Basic , Visual C# )內建 129 個 Comlet可以外掛其它 Comlet ,例如 Exchnage …
參數Comlet 可以加上參數其實是 Comlet 類別的屬性
9/41
物件 ?
用來表示真實 Windows 下的各種東西,例如 : 服務、行程、磁碟、…屬性 : 用來描述物件的狀態
NameStartModeStatus
方法 : 用來進行物件的操作動作StopStartPause
10/41
Pipeline
所有的 cmdlets 處理的都物件,不是文字 !所有的 cmdlets 都在一個 pipeline 中執行所有的 pipeline 都會由一個特別的 comlet 做結束,用來將結果的物件以文字顯示出來
選擇要顯示的屬性,以及他們的數值將屬性格式化成表格呈現出來
11/41
PipelineCmdlet
1. Property = Value2. Property = Value3. Property = Value4. Property = Value
Out-Default
一個簡單的 Pipeline 範例
12/41
PipelineCmdlet
1. Property = Value2. Property = Value3. Property = Value4. Property = Value
Out-DefaultCmdlet
多重 Cmdlet Pipeline 範例
13/41
如何取得協助 ?
PowerShell 提供一組 comlets 來讓你查詢 PowerShell 的用法
Get-Command cmdlet 可以顯示出有那些功能可以用Get-Help cmdlet 則顯示該怎麼用這些 comletsGet-Member cmdlet 則可以列出物件的屬性與方法
如果你是開發人員有點像是 MSDN Help …
標準的命名規則Get-*, Stop-*, …很容 " 猜 " 出指令與參數 !
14/41
懶得打字 ?!
提供 Comlet 的簡短別名cd = Set-Locationdir = Get-ChildItemtype = Get-Contentren = Rename-Item
可以使用 Get-Alias 來查詢 !可以用 New-Alias 來建立你自己的指令別名 !
15/41
DEMO
16/41
Windows Server Core
• 安裝最小化安裝模式• 命令列管理介面• 簡化管理• 減少受攻擊的可能
伺服器角色
Server CoreSecurity, TCP/IP, File Systems, RPC,plus other Core Server Sub-Systems
DNS DHCP File AD
GUI, CLR, IE, Media Player,
Outlook Express, …
17/41
Windows Server Core
18/41
System32 資料夾的內容 – 完整安裝
System32 資料夾的內容 – Server CoreSystem32 資料夾的內容 – Server Core
19/41
Server Core 架構
Server Core Server Roles
Server CoreSecurity, TCP/IP, File Systems, RPC,plus other Core Server Sub-Systems
DNS DHCP FileAD
ServerWith .NetFx, Shell, Tools, etc.
TS IASWeb
ServerSharePoint
Etc…
GUI, CLR, Shell, IE,
Media, OE, Etc.
Server, Server Roles
ADLDS
MediaServer
IIS 7 WVSPrint
20/41
Tools and Commands
Net User – Set administrator passwordNetsh – Manage network interfaces/firewallNetdom – Join domain/renameOCSetup – Add features and roles (case sensitive)
DNS-Server-Core-RoleDHCPServerCoreFRS-InfrastructurePrinting-ServerCore-RoleDirectoryServices-ADAM-ServerCoreMediaServer (requires separate download)
DCPromo with unattend file – Active Directory
21/41
遠端管理 Server Core #1
更改密碼net user administrator *
設定主機 IP, DNSnetsh int ip set address “ 網路名稱” static 192.168.99.3 255.255.255.0 192.168.99.254netsh int ip set dnsserver “ 網路名稱” static 192.168.99.1
設定電腦名稱 :netdom renamecomputer %computername% /newname:MyPC
加入網域netdom join MyPC /domain:mcg.com /usero:Administrator /passwordo:P@ssw0rd /userd:Administrator /passwordd:P@ssw0rd /reboot
22/41
遠端管理 Server Core #2
啓動 Windowsslmgr.vbs -ato
允許遠端桌面HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\ fDenyTSConnections = 0netsh firewall set portopening tcp 3389 "Remote Desktop"
允許 MMC 遠端管理開啟 UDP 137, 138 以及 TCP 139, 445 ports
23/41
Roles & Features 安裝與管理
OCList.exe只有在 Server Core 才有的指令列出所有可以用的 Roles 和 Features 套件還可以標示出那一個套件已安裝
OCSetup.exe安裝 Roles 或 Features使用 Ocsetup 加上 /uninstall 參數來解除安裝
24/41
使用 Windows Remote Shell 管理
Windows Remote Management (WinRM) WS-Management
Windows Remote Shell (WinRS)支援 Windows Vista / Windows Server 2008只能執行命令列工具或腳本不支援互動模式
例如 : " 請按任意鍵繼續 … "
25/41
設定 WinRM
使用命令列WinRM quickconfig
使用 unattend 檔在 <settings pass=“specialize”> 區段中加入 :<component
name=“Microsoft-Windows-Web-Services-for-Management-Core” publicKeyToken=“31bf3856ad364e35” language=“neutral” versionScope=“nonSxS” processorArchitecture=“x86”> <ConfigureWindowsRemoteManagement>
true
</ConfigureWindowsRemoteManagement>
</component>
也可以使用群組原則來設定
26/41
使用 WinRS
WinRS -r:< 遠端主機 > 命令遠端主機可以是 :
-r:https://myserver.com
-r:myserver
-r:http://127.0.0.1
-r:http://169.51.2.101:80
例如winrs -r:myserver dir c:\windows\system32\*.dll
27/41
WinRS 範例
啓用 Terminal Services 遠端管理winrs -r:myserver cscript \windows\system32\scregedit.wsf /ar 0
允許舊的 TS 用戶端 (Vista 之前 )winrs -r:myserver cscript \windows\system32\scregedit.wsf /cs 0
加入網域winrs -r:myserver netdom add myserver /domain:testdomain /userd:administrator /passwordd:<password>
將網域管理員加入本機管理者群組winrs -r:myserver net localgroup administrators testdomain\administrator /add
28/41
Server Core 硬體管理
Server Core 支援隨插即用硬體會在背景自動安裝驅動程式
如果沒有內建驅動程式 …手動拷貝驅動程式檔案到 Server Core 中pnputil -i -a driverinf
列出所有已安裝的驅動程式sc query type= driver
移除驅動程式sc delete 服務名稱
29/41
Server Core 的控制台 ?!
只有部份的控制台項目可以使用變更時區
control timedate.cpl
變更鍵盤與語言control intl.cpl
30/41
DEMO
31/41
Terminal Services
平台改進• 重新調過的核心• 擴充過的 WMI 介面• 改善管理功能• 支援隨插即用裝置的轉向 Framework
功能改進• TS RemoteApp™• TS Gateway• TS Web Access• TS Easy Print• TS Session Broker
32/41
外部
防火
牆
內部
防火
牆
Internet DMZ Intranet
遠端使用者 Terminal Services Gateway
Network Policy Server
Active Directory DC
Tunnels RDP over HTTPs
Strips off RDP / HTTPs
Terminal Servers and
other RDP Hosts
RDP 通訊轉送到 TS
Internet
Terminal Services Gateway
33/41
Terminal Services RemoteApp™
Terminal ServicesGateway Server
• 遠端程式與本機電腦整合• 集中管理所有的
Terminal Server
• 使用 Remote Programs 主控台來管理應用程式
• 允許設定透過 TS Web Access 來執行應用程式
34/41
Terminal Services RemoteApp™
Terminal ServicesGateway Server
必須使用遠端桌面
• 程式就好像是在本機執行一樣
• 只支援使用遠端桌面的用戶
35/41
DEMO
36/41
Internet Information Services (IIS) 7.0
模組化架構
高管理性
內建要求追蹤功能
可延伸的設計
與 .NET 完全整合
IIS 7.0 加強功能
100% 管控 IIS 所有功能
減少受攻擊面
延伸 / 修改 IIS 各項功能
應用程式快速部署
快速診斷
37/41
模組化設計模組化 pipeline
各項能被被計成單一的模組可以視需求新增 / 移除 / 取代每一個模組
減少被攻擊的機會減少記憶體使用與提高安全性增加效能
模組可以是 native code 或 manage code延伸 .NET 的強大能力到 IIS 7.0 上容易整合新的技術
模組化管理介面外加自訂介面到管理介面上 (windows forms)使用 IIS 管理介面來管理您的應用程式
38/41
IIS 7.0 處理機制
傳送回應記錄檔 壓縮
NTLM 基本
IIS 決定由誰處理
CGI
靜態檔案
ISAPI
身份驗證匿名
傳送回應
身份驗證
授權
解析快取
ExecuteHandler
更新快取…
…
伺服器的功能細分成超過 40 個 模組 ...
各個模組會掛到 generic request pipeline …
每個模組透過一個 public module API 來 延伸伺服器功能
…
…
39/41
管理 IIS 7.0
完善的管理工具
委派管理
安全的遠端管理
Web Farms 共用 IIS 7.0 組態
IIS7
更好用的工具 :以工作為導向的管理工具透過 .NET API 管理 IISIIS/ASP.NET 支援 WMI 提供者完整的命令工具支援,例如 : appcmd豐富的執行時期資訊自動化錯誤追蹤與記錄
IIS7
IIS7
網站管理員 Web.config
XML
權力委派
XCopy 部署
系統管理人員
Internet
遠端管理
HTTPS
AppHost.config
XML
共用應用程式平台
UNC
Web Farm應用程式
共用組態
40/41
IIS 7.0 與 ASP.NET 整合傳統模式
使用 ISAPI 執行 ASP.NET
整合模式.NET modules / handlers 直接接到 IIS 7.0 處理管道中可以處理任何要求100% 執行時期支援
記錄
壓縮
基本
靜態檔案
ISAPI
匿名
傳送回應
身份驗證
授權
解析快取
執行 Handler
更新快取…
…身份驗證
表單 Windows
對應Handler
ASPX
Trace
……
…
aspnet_isapi.dll
41/41
DEMO