^ ' CHIA SẺ - KINH NGHIỆM - HỌC TẬP - THỦ THUẬT Part 40 - Upgrade Server 2008 - Windows PowerShell Trong Windows Server 2008 Microsoft đã tích hợp thém mét céng cu mdi la Winows PowerSh
Trang 1^ '
CHIA SẺ - KINH NGHIỆM - HỌC TẬP - THỦ THUẬT Part 40 - Upgrade Server 2008 - Windows PowerShell
Trong Windows Server 2008 Microsoft đã tích hợp thém mét céng cu mdi la Winows PowerShell day la mét céng cu ddi sau cua DOS Command Nhu vậy với Pow erShell ta hoàn toàn có thể sử dụng các câu lệnh trong DOS Command tuy nhién PowerShell con có tính gợi nhớ lệnh khi bạn nhấn phím Tab và nhiều câu lệnh hơn DOS Command
Windows PowerShell hé trợ các phiên bản Window s XP, Windows Server 2003 và Windows Vista
Trong Window s Server 2008 để cài đặt Window s Pow erShell bạn bật Server Manager lên chọn Featues ->
Add Features
i Server Manager
File Action View Help
@ |||
my Server Manager (SERVER)
Features
ï Diaqnostics View the status of fanregials on this server and add or remove features
3 Storage C
a Remove Features
‘*) Features: ogt3s installed ees Add Features
Trong Select Feature ban chon Windows PowerShell (WPS) va tién hanh cai dat WPS lên máy
Trang 2Add Features Wizard
| Select Features
|
sắn: Select one or more features to install on this server
Confirmation Features:
Progress |_| Quality Windows ni Wie Experience n
|_| Remote Differential Compression [_] Remote S dministration Tools
Storage Manager for SANs [_] Subsystem for UNIX-based Applications
[| Telnet Client + [| Telnet Server
L] TFTP Client [| Windows Internal Database Windows PowerShell
|_| Windows Process Activation Service [L_] Windows Server Backup Features
|] Windows System Resource Manager L_] WINS Server
Sau khi cai dat hoan tat ban vao Start -> Programs -> Windows PowerShell dé chay PWS
i
4) at Windows Update
Accessories
_ Administrative Tools <,
| extras and Uncrade >
_ Microsoft &front TMG
Ay Programs
BS) Windows PowerShell
Để xem tất cả các lệnh có trong PWS bạn nhập lệnh:
Help
2 of 7
Trang 3& windows PowerShell , 1 a -|5) x} Windows PowerShell
Copyright ¢C> 2006 Microsoft Corporation All rights reserved 4
PS C:\Users\Administrator> help
Category
PWS thừa kế tất cả các lệnh của DOS Com mand nên trong PWS ta có thể sử dụng mọi lệnh trong DOS
Command
r3 '
~
1
Aol She r 1
089 a: Desktc
T215} = t We
= =
Để biết được cú pháp của một lệnh bạn nhập lệnh:
Get-Help [Tên lệnh]
Trang 4?® windows PowerShell w
PS C:\Users\Administrator> Get—Help cd
lst al a
Set—Location
Sets the current working location to a specif ied location
Set-Location L[-pathl <string>l [-passThru] [<CommonParameters >]
Set-Location [-stackName ST nh [—passThru] [<CommonParameters> ]
Set—Location [-literalPath] <string> [—passThru] ([<CommonParameters> ]
DETAILED DESGRIPTION
The set-location Cmdlet sets the working location to a specified loca
b-directory, a registry location or another location stack
Để tạo một thư mục mới bạn sử dụng lệnh:
New-Ttem [Tên thu muc] - ItemType Directory
PS G:é*N> Neu-lItem Data -ItemTupe DirnectoUu
DirecCoru: Microsoft.PouerShe L1.Corne*EF1leSustemz: :€z`
LastWriteT ime Length Nanec
1/14/2009 7:48 AM Data
Directory: Microsoft PowerShe11.Core\FileSystem::C:\
y LastWriteTime ò Length Name 1/14/2669 ,
1⁄12⁄2089 8192 BOOTSECT BAK
Để tạo một tập tin mới bạn nhập lệnh:
Set-Content -path "[Dudng dẫn tập tin]" -value "[Nội dung tập tin]"
Để xem nội dung một tập tin nào đó bạn nhập lệnh:
Get-Content "[Đường dẫn tập tin]"
4 of 7
Trang 5& windows PowerShell
PS C:N\> Set-content —-path “"C:\Data\gcconm.txt’ —value
PS C:\> Get—-Content "C:\Data\gccon.txt”™
Để xóa một tập tin hoặc thư mục nào đó bạn nhập lệnh:
Remove-Item "[Đường dẫn tập tin hoặc đường dẫn thư mục]"
®& windows PowerShell
PS G:\> Remove-Item "C:\Data\gccom.txt"
PS C:\> Remove-Item "C:\Data"
I Sepa tech yee &=
Để xuất kết quả của một nội dung nào đó ra các tập tin khác ta sử dụng lệnh:
[Câu lệnh] > [Tập tin xuất ra/Đường dẫn tập tin xuất ra]
Để mở một tập tin nào đó với Notepad bạn nhập lệnh:
Notepad [Tên tập tin/ Đường dẫn tập tin]
Trang 6
PS GsN\> TET /a1l >ipconfig.txt
PS CrN\> notepad ipconfig.txt
Ly LAS
Ethernet adapter Cross:
Connection- SHECSEE I DNS Suffix
Physical Address
DHCP Enabled ; Autoconfi guration Enabled
IPv4 Address - ws
Subnet Mask
Default Gateway “ NetBIOS over Tcpip
Để xem thông tin hệ thống bạn nhập lệnh:
Get-Process
& windows PowerShell
PS C:\> Get—Process
NPH<K> USCK> UH‹<H>
{
6
yA
8
28
6
9 l2
18
8
G
: NO : Yes
: 172.16.1.2(Preferred)
GPU <s 3
- b8
„64 A csFss
„81 1476 dsamain -12 4U dưnm
-98 2844 explorer
„808 3716 iashost
File Edit Format View Help
DNS suffix Search List gccom net
Intel 21140-Based PCI Fast Ethernet 00-03-FF-C4-EB-2C
255.255 230.'
: 479° 16.1.4
Enabled
@ Idle aoe 1) 1524 inetinfo
.88 1668 isastg
ye] 612 lsass 16 628 1sm
36 1112 msdtc
16.26 8.19 B44 8.42 14.46
2146 mspadmin
4656 notepad
1644 powershell
1926 ReportingSer
666 services
Để đóng một chương trình nào đó của hệ thống bạn nhập câu lệnh:
KilIlI [TD của chương trình]
6 of 7
Trang 7PS GC:\> Kill 1476
Để xem thông tin về CPU bạn nhập lệnh:
Get-Wmiobject -Class win32_ processor
GENUS
CLASS
SUPERCLASS
DYNASTY
RELPATH
PROPERTY_COUNT
DERIUATION
SERVER
NAMES PACE
PATH
AddressWidth
rchitecture
Availability
Caption
Conf igManagerErrorCode
Conf igManagerUserConf ig
CpuStatus
Creat ionClassName
CurrentClockS peed
urrentUoltage
DataWidth
Description
)eulicelD
rrorCleared
rrorDescription
nstallDate
2CacheSize
PS C:\> Get—-Wmi0bject -Class win32_processor
CO 2
Win32_Processor CIM_Processor
CIM_ManagedS ystemElement
Win32_Processor Device! D=""CPU6"
48
PG82
32
8
x86 Family 6 Model 14 Stepping 12
Min32_Processor
rT
“+
x86 Family 6 Model 14 Stepping 12
CPUG
168
17
<CIM_Processor, CIM_LogicalDevice CIM_L
NNPCG2\root\c imv2 -Win32_Processor.Device
astErrorCode
evel
oadPercentage
OK mình vừa trình bày xong phần Windows Power Shell trong 70-648, 70-649 của MCSA
Công ty TNHH đầu tư phát triển tin học GC Com
Chuyên trang kỹ thuật máy vi tính cho kỹ thuật viên tin học Điện thoại: (073) - 3.511.373 - 6.274.294 Website: http://www.gccom.net