{"id":85385,"date":"2025-03-28T11:41:32","date_gmt":"2025-03-28T04:41:32","guid":{"rendered":"https:\/\/itviecblog.uptech.vn\/?p=85385"},"modified":"2025-06-18T15:46:58","modified_gmt":"2025-06-18T08:46:58","slug":"cac-lenh-trong-powershell","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/","title":{"rendered":"Top 30+ c\u00e1c l\u1ec7nh trong Powershell ph\u1ed5 bi\u1ebfn nh\u1ea5t"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#Tong_quan_ve_Powershell\" >T\u1ed5ng quan v\u1ec1 Powershell<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#Cac_lenh_trong_Powershell_quan_trong_va_pho_bien_can_nho\" >C\u00e1c l\u1ec7nh trong Powershell quan tr\u1ecdng v\u00e0 ph\u1ed5 bi\u1ebfn c\u1ea7n nh\u1edb<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#Meo_su_dung_cac_lenh_trong_Powershell_hieu_qua_hon\" >M\u1eb9o s\u1eed d\u1ee5ng c\u00e1c l\u1ec7nh trong Powershell hi\u1ec7u qu\u1ea3 h\u01a1n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#Cac_cau_hoi_thuong_gap_ve_cac_lenh_trong_Powershell\" >C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 c\u00e1c l\u1ec7nh trong Powershell<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#Tong_ket_cac_lenh_trong_Powershell\" >T\u1ed5ng k\u1ebft c\u00e1c l\u1ec7nh trong Powershell<\/a><\/li><\/ul><\/nav><\/div>\n<p><em><strong>C\u00e1c c\u00e2u l\u1ec7nh trong PowerShell l\u00e0 c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd gi\u00fap t\u1ef1 \u0111\u1ed9ng h\u00f3a t\u00e1c v\u1ee5, qu\u1ea3n l\u00fd t\u1ec7p, th\u01b0 m\u1ee5c, ti\u1ebfn tr\u00ecnh v\u00e0 d\u1ecbch v\u1ee5 m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3. N\u1ebfu b\u1ea1n \u0111ang t\u00ecm ki\u1ebfm danh s\u00e1ch l\u1ec7nh PowerShell t\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao \u0111\u1ec3 t\u1ed1i \u01b0u c\u00f4ng vi\u1ec7c, b\u00e0i vi\u1ebft n\u00e0y s\u1ebd cung c\u1ea5p h\u01b0\u1edbng d\u1eabn chi ti\u1ebft k\u00e8m v\u00ed d\u1ee5 th\u1ef1c t\u1ebf. H\u00e3y c\u00f9ng ITviec kh\u00e1m ph\u00e1 c\u00e1c l\u1ec7nh trong PowerShell quan tr\u1ecdng v\u00e0 ph\u1ed5 bi\u1ebfn nh\u1ea5t gi\u00fap b\u1ea1n l\u00e0m ch\u1ee7 h\u1ec7 th\u1ed1ng Windows m\u1ed9t c\u00e1ch d\u1ec5 d\u00e0ng.<\/strong><\/em><\/p>\n<p><span style=\"font-weight: 400;\">\u0110\u1ecdc b\u00e0i vi\u1ebft \u0111\u1ec3 bi\u1ebft th\u00eam v\u1ec1:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Powershell l\u00e0 g\u00ec?<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">So s\u00e1nh Powershell v\u00e0 CMD<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ph\u00e2n lo\u1ea1i c\u00e1c c\u00e2u l\u1ec7nh Powershell<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">M\u1eb9o s\u1eed d\u1ee5ng Powershell hi\u1ec7u qu\u1ea3 h\u01a1n<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Tong_quan_ve_Powershell\"><\/span><b>T\u1ed5ng quan v\u1ec1 Powershell<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>Powershell l\u00e0 g\u00ec?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">PowerShell l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 c\u1ee7a Microsoft h\u1ed7 tr\u1ee3 l\u1eadp tr\u00ecnh cho c\u00e1c t\u00e1c v\u1ee5 t\u1ef1 \u0111\u1ed9ng h\u00f3a, qu\u1ea3n l\u00fd c\u1ea5u h\u00ecnh v\u00e0 vi\u1ebft script. \u0110\u00e2y l\u00e0 m\u1ed9t giao di\u1ec7n d\u00f2ng l\u1ec7nh m\u00e3 ngu\u1ed3n m\u1edf, c\u00f3 th\u1ec3 ch\u1ea1y tr\u00ean Windows, macOS v\u00e0 Linux. PowerShell gi\u00fap l\u1eadp tr\u00ecnh vi\u00ean ti\u1ebft ki\u1ec7m th\u1eddi gian b\u1eb1ng c\u00e1ch \u0111\u01a1n gi\u1ea3n h\u00f3a c\u00e1c c\u00f4ng vi\u1ec7c l\u1eb7p \u0111i l\u1eb7p l\u1ea1i v\u00e0 l\u01b0u tr\u1eef l\u1ec7nh \u0111\u1ec3 s\u1eed d\u1ee5ng l\u1ea1i sau n\u00e0y.<\/span><\/p>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"\/blog\/powershell-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>PowerShell l\u00e0 g\u00ec chi ti\u1ebft: T\u00ednh n\u0103ng, C\u00e0i \u0111\u1eb7t, M\u1eb9o s\u1eed d\u1ee5ng n\u00ean bi\u1ebft<\/strong><\/a><\/em><\/p><\/blockquote>\n<h3><b>\u01afu v\u00e0 nh\u01b0\u1ee3c \u0111i\u1ec3m c\u1ee7a Powershell<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>\u01afu \u0111i\u1ec3m<\/b><\/td>\n<td><b>Nh\u01b0\u1ee3c \u0111i\u1ec3m<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">T\u1ef1 \u0111\u1ed9ng h\u00f3a m\u1ea1nh m\u1ebd: H\u1ed7 tr\u1ee3 qu\u1ea3n tr\u1ecb h\u1ec7 th\u1ed1ng, tri\u1ec3n khai ph\u1ea7n m\u1ec1m, v\u00e0 qu\u1ea3n l\u00fd m\u00e1y ch\u1ee7 m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u0110\u01b0\u1eddng cong h\u1ecdc t\u1eadp cao: C\u00fa ph\u00e1p ph\u1ee9c t\u1ea1p h\u01a1n so v\u1edbi CMD ho\u1eb7c Bash, kh\u00f3 ti\u1ebfp c\u1eadn v\u1edbi ng\u01b0\u1eddi m\u1edbi.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">T\u01b0\u01a1ng th\u00edch \u0111a n\u1ec1n t\u1ea3ng: H\u1ed7 tr\u1ee3 Windows, macOS, v\u00e0 Linux, gi\u00fap qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng linh ho\u1ea1t h\u01a1n.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Hi\u1ec7u su\u1ea5t c\u00f3 th\u1ec3 th\u1ea5p h\u01a1n CMD: M\u1ed9t s\u1ed1 l\u1ec7nh \u0111\u01a1n gi\u1ea3n ch\u1ea1y ch\u1eadm h\u01a1n CMD do PowerShell d\u1ef1a tr\u00ean .NET.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">T\u00edch h\u1ee3p t\u1ed1t v\u1edbi h\u1ec7 sinh th\u00e1i Microsoft: Qu\u1ea3n l\u00fd Active Directory, Azure, Office 365, Exchange d\u1ec5 d\u00e0ng.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Kh\u00f4ng ph\u1ed5 bi\u1ebfn tr\u00ean Linux v\u00e0 macOS: M\u1eb7c d\u00f9 h\u1ed7 tr\u1ee3, nh\u01b0ng Bash v\u1eabn l\u00e0 l\u1ef1a ch\u1ecdn ch\u00ednh tr\u00ean h\u1ec7 \u0111i\u1ec1u h\u00e0nh n\u00e0y.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng cao: H\u1ed7 tr\u1ee3 script, module, v\u00e0 c\u00f3 th\u1ec3 m\u1edf r\u1ed9ng v\u1edbi .NET Framework.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Y\u00eau c\u1ea7u quy\u1ec1n Administrator cho nhi\u1ec1u l\u1ec7nh: M\u1ed9t s\u1ed1 l\u1ec7nh quan tr\u1ecdng c\u1ea7n ch\u1ea1y v\u1edbi quy\u1ec1n qu\u1ea3n tr\u1ecb vi\u00ean.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">H\u1ed7 tr\u1ee3 pipeline m\u1ea1nh m\u1ebd: C\u00f3 th\u1ec3 k\u1ebft h\u1ee3p nhi\u1ec1u l\u1ec7nh \u0111\u1ec3 x\u1eed l\u00fd d\u1eef li\u1ec7u tr\u1ef1c ti\u1ebfp m\u00e0 kh\u00f4ng c\u1ea7n t\u1ea1o file trung gian.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Kh\u00f4ng th\u00e2n thi\u1ec7n v\u1edbi ng\u01b0\u1eddi d\u00f9ng kh\u00f4ng chuy\u00ean: Ch\u1ee7 y\u1ebfu d\u00e0nh cho qu\u1ea3n tr\u1ecb vi\u00ean h\u1ec7 th\u1ed1ng v\u00e0 l\u1eadp tr\u00ecnh vi\u00ean.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">M\u00e3 ngu\u1ed3n m\u1edf v\u00e0 c\u1eadp nh\u1eadt th\u01b0\u1eddng xuy\u00ean: \u0110\u01b0\u1ee3c Microsoft ph\u00e1t tri\u1ec3n v\u00e0 c\u1ea3i ti\u1ebfn li\u00ean t\u1ee5c.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">H\u1ea1n ch\u1ebf trong vi\u1ec7c t\u01b0\u01a1ng t\u00e1c v\u1edbi GUI: T\u1eadp trung v\u00e0o d\u00f2ng l\u1ec7nh, kh\u00f4ng m\u1ea1nh v\u1ec1 thao t\u00e1c giao di\u1ec7n \u0111\u1ed3 h\u1ecda.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>So s\u00e1nh Powershell v\u00e0 CMD<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>Ti\u00eau ch\u00ed<\/b><\/td>\n<td><b>Powershell<\/b><\/td>\n<td><b>CMD (Command Prompt)<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">M\u1ee5c \u0111\u00edch s\u1eed d\u1ee5ng<\/span><\/td>\n<td><span style=\"font-weight: 400;\">D\u00e0nh cho qu\u1ea3n tr\u1ecb vi\u00ean h\u1ec7 th\u1ed1ng, DevOps, l\u1eadp tr\u00ecnh vi\u00ean, h\u1ed7 tr\u1ee3 t\u1ef1 \u0111\u1ed9ng h\u00f3a m\u1ea1nh m\u1ebd.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Ch\u1ee7 y\u1ebfu d\u00e0nh cho ng\u01b0\u1eddi d\u00f9ng ph\u1ed5 th\u00f4ng th\u1ef1c hi\u1ec7n c\u00e1c l\u1ec7nh h\u1ec7 th\u1ed1ng c\u01a1 b\u1ea3n.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p l\u1ec7nh<\/span><\/td>\n<td><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng c\u00fa ph\u00e1p \u0110\u1ed9ng t\u1eeb-Danh t\u1eeb (Verb-Noun cmdlets) v\u00e0 h\u1ed7 tr\u1ee3 l\u1eadp tr\u00ecnh v\u1edbi <\/span><span style=\"font-weight: 400;\">.NET Framework<\/span><span style=\"font-weight: 400;\">.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng c\u00fa ph\u00e1p \u0111\u01a1n gi\u1ea3n d\u1ef1a tr\u00ean c\u00e1c l\u1ec7nh DOS.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Kh\u1ea3 n\u0103ng t\u1ef1 \u0111\u1ed9ng ho\u00e1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">M\u1ea1nh m\u1ebd, h\u1ed7 tr\u1ee3 script n\u00e2ng cao, v\u00f2ng l\u1eb7p, \u0111i\u1ec1u ki\u1ec7n.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">H\u1ea1n ch\u1ebf, ch\u1ec9 h\u1ed7 tr\u1ee3 batch script (.bat, .cmd) \u0111\u01a1n gi\u1ea3n.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">T\u01b0\u01a1ng th\u00edch h\u1ec7 \u0111i\u1ec1u h\u00e0nh<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u0110a n\u1ec1n t\u1ea3ng: Windows, macOS, Linux.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Ch\u1ec9 ch\u1ea1y tr\u00ean Windows.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">H\u1ed7 tr\u1ee3 pipeline<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Cho ph\u00e9p truy\u1ec1n d\u1eef li\u1ec7u gi\u1eefa c\u00e1c l\u1ec7nh v\u00e0 x\u1eed l\u00fd linh ho\u1ea1t.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">H\u1ea1n ch\u1ebf, ch\u1ec9 ho\u1ea1t \u0111\u1ed9ng v\u1edbi m\u1ed9t s\u1ed1 l\u1ec7nh nh\u1ea5t \u0111\u1ecbnh.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng<\/span><\/td>\n<td><span style=\"font-weight: 400;\">H\u1ed7 tr\u1ee3 module, cmdlet v\u00e0 t\u00edch h\u1ee3p v\u1edbi Azure, Active Directory, SQL Server.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Kh\u00f4ng th\u1ec3 m\u1edf r\u1ed9ng, ch\u1ec9 d\u00f9ng c\u00e1c l\u1ec7nh c\u00f3 s\u1eb5n.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Hi\u1ec7u su\u1ea5t<\/span><\/td>\n<td><span style=\"font-weight: 400;\">C\u00f3 th\u1ec3 ch\u1eadm h\u01a1n CMD trong m\u1ed9t s\u1ed1 t\u00e1c v\u1ee5 \u0111\u01a1n gi\u1ea3n do d\u1ef1a tr\u00ean .NET Framework.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Nhanh h\u01a1n khi th\u1ef1c hi\u1ec7n c\u00e1c l\u1ec7nh h\u1ec7 th\u1ed1ng c\u01a1 b\u1ea3n nh\u01b0 copy, move, del.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Kh\u1ea3 n\u0103ng t\u01b0\u01a1ng t\u00e1c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">C\u00f3 th\u1ec3 ch\u1ea1y l\u1ec7nh CMD b\u1eb1ng <\/span><span style=\"font-weight: 400;\">cmd.exe<\/span><span style=\"font-weight: 400;\">.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Kh\u00f4ng th\u1ec3 ch\u1ea1y tr\u1ef1c ti\u1ebfp l\u1ec7nh PowerShell.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">PowerShell l\u00e0 c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd d\u00e0nh cho System Administrators, DevOps Engineers v\u00e0 Developers, cung c\u1ea5p kh\u1ea3 n\u0103ng t\u1ef1 \u0111\u1ed9ng h\u00f3a, qu\u1ea3n l\u00fd c\u1ea5u h\u00ecnh v\u00e0 x\u1eed l\u00fd d\u1eef li\u1ec7u linh ho\u1ea1t nh\u1edd h\u1ed7 tr\u1ee3 cmdlet, scripting v\u00e0 pipeline. Trong khi \u0111\u00f3, CMD ph\u00f9 h\u1ee3p h\u01a1n v\u1edbi ng\u01b0\u1eddi d\u00f9ng ph\u1ed5 th\u00f4ng, gi\u00fap th\u1ef1c hi\u1ec7n nhanh ch\u00f3ng c\u00e1c l\u1ec7nh h\u1ec7 th\u1ed1ng c\u01a1 b\u1ea3n tr\u00ean Windows. N\u1ebfu b\u1ea1n c\u1ea7n m\u1ed9t c\u00f4ng c\u1ee5 \u0111\u01a1n gi\u1ea3n \u0111\u1ec3 qu\u1ea3n l\u00fd t\u1ec7p ho\u1eb7c th\u01b0 m\u1ee5c, CMD l\u00e0 l\u1ef1a ch\u1ecdn \u0111\u1ee7 d\u00f9ng. Tuy nhi\u00ean, n\u1ebfu mu\u1ed1n t\u1ef1 \u0111\u1ed9ng h\u00f3a t\u00e1c v\u1ee5 ph\u1ee9c t\u1ea1p v\u00e0 t\u00edch h\u1ee3p s\u00e2u v\u1edbi h\u1ec7 th\u1ed1ng, PowerShell s\u1ebd l\u00e0 gi\u1ea3i ph\u00e1p t\u1ed1i \u01b0u h\u01a1n.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cac_lenh_trong_Powershell_quan_trong_va_pho_bien_can_nho\"><\/span><b>C\u00e1c l\u1ec7nh trong Powershell quan tr\u1ecdng v\u00e0 ph\u1ed5 bi\u1ebfn c\u1ea7n nh\u1edb<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">C\u00e1c l\u1ec7nh PowerShell, hay cmdlet, tu\u00e2n theo c\u00fa ph\u00e1p \u0111\u1ed9ng t\u1eeb &#8211; danh t\u1eeb, trong \u0111\u00f3 \u0111\u1ed9ng t\u1eeb ch\u1ec9 h\u00e0nh \u0111\u1ed9ng v\u00e0 danh t\u1eeb l\u00e0 \u0111\u1ed1i t\u01b0\u1ee3ng. N\u1eafm v\u1eefng c\u00fa ph\u00e1p n\u00e0y s\u1ebd gi\u00fap b\u1ea1n s\u1eed d\u1ee5ng PowerShell hi\u1ec7u qu\u1ea3 h\u01a1n.<\/span><\/p>\n<h3><b>Nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell \u0111\u1ec3 tr\u1ee3 gi\u00fap<\/b><\/h3>\n<h4><b>Get-Help<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Cung c\u1ea5p th\u00f4ng tin chi ti\u1ebft v\u1ec1 m\u1ed9t cmdlet c\u1ee5 th\u1ec3, gi\u00fap b\u1ea1n hi\u1ec3u c\u00e1ch s\u1eed d\u1ee5ng l\u1ec7nh.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Get-Help Get-Process<\/span><span style=\"font-weight: 400;\"> hi\u1ec3n th\u1ecb h\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng cmdlet <\/span><span style=\"font-weight: 400;\">Get-Process<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4><b>Get-Command<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 c\u00e1c l\u1ec7nh c\u00f3 s\u1eb5n trong PowerShell.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Get-Command -Noun Process<\/span><span style=\"font-weight: 400;\"> hi\u1ec3n th\u1ecb c\u00e1c l\u1ec7nh c\u00f3 ch\u1ee9a danh t\u1eeb &#8220;Process&#8221;.<\/span><\/p>\n<h4><b>Get-Alias<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Hi\u1ec3n th\u1ecb danh s\u00e1ch b\u00ed danh c\u1ee7a c\u00e1c cmdlet PowerShell, gi\u00fap ng\u01b0\u1eddi d\u00f9ng d\u1ec5 d\u00e0ng nh\u1eadn di\u1ec7n c\u00e1c l\u1ec7nh vi\u1ebft t\u1eaft.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Get-Alias -Name ls<\/span><span style=\"font-weight: 400;\"> ki\u1ec3m tra xem ls l\u00e0 b\u00ed danh c\u1ee7a cmdlet n\u00e0o trong PowerShell (th\u01b0\u1eddng l\u00e0 <\/span><span style=\"font-weight: 400;\">Get-ChildItem<\/span><span style=\"font-weight: 400;\">).<\/span><\/p>\n<h3><b>Nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell \u0111\u1ec3 th\u00f4ng tin &amp; qu\u1ea3n tr\u1ecb<\/b><\/h3>\n<h4><b>Get-Process<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Hi\u1ec3n th\u1ecb danh s\u00e1ch ti\u1ebfn tr\u00ecnh \u0111ang ch\u1ea1y tr\u00ean h\u1ec7 th\u1ed1ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Get-Process -Name &#8220;notepad&#8221;<\/span><span style=\"font-weight: 400;\"> gi\u00fap ki\u1ec3m tra xem Notepad c\u00f3 \u0111ang ho\u1ea1t \u0111\u1ed9ng hay kh\u00f4ng.<\/span><\/p>\n<h4><b>Stop-Process<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">D\u1eebng m\u1ed9t ti\u1ebfn tr\u00ecnh \u0111ang ch\u1ea1y b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng t\u00ean ho\u1eb7c ID.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Stop-Process -Name &#8220;notepad&#8221; -Force<\/span><span style=\"font-weight: 400;\"> s\u1ebd bu\u1ed9c \u0111\u00f3ng t\u1ea5t c\u1ea3 c\u1eeda s\u1ed5 Notepad \u0111ang m\u1edf.<\/span><\/p>\n<h4><b>Get-Service<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Ki\u1ec3m tra tr\u1ea1ng th\u00e1i c\u1ee7a m\u1ed9t d\u1ecbch v\u1ee5.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Get-Service -Name &#8220;wuauserv&#8221;<\/span><span style=\"font-weight: 400;\"> s\u1ebd hi\u1ec3n th\u1ecb tr\u1ea1ng th\u00e1i c\u1ee7a d\u1ecbch v\u1ee5 Windows Update.<\/span><\/p>\n<h4><b>Start-Service<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Kh\u1edfi \u0111\u1ed9ng m\u1ed9t d\u1ecbch v\u1ee5.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: Ch\u1ea1y <\/span><span style=\"font-weight: 400;\">Start-Service -Name &#8220;wuauserv&#8221;<\/span><span style=\"font-weight: 400;\"> s\u1ebd k\u00edch ho\u1ea1t d\u1ecbch v\u1ee5 Windows Update n\u1ebfu n\u00f3 \u0111ang b\u1ecb t\u1eaft.<\/span><\/p>\n<h4><b>Stop-Service<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">D\u1eebng m\u1ed9t d\u1ecbch v\u1ee5 \u0111ang ch\u1ea1y.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Stop-Service -Name &#8220;wuauserv&#8221;<\/span><span style=\"font-weight: 400;\"> s\u1ebd t\u1eaft Windows Update.<\/span><\/p>\n<h3><b>Nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell \u0111\u1ec3 qu\u1ea3n l\u00fd t\u1eadp tin &amp; th\u01b0 m\u1ee5c<\/b><\/h3>\n<h4><b>Get-Item<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">L\u1ea5y th\u00f4ng tin chi ti\u1ebft v\u1ec1 m\u1ed9t t\u1ec7p ho\u1eb7c th\u01b0 m\u1ee5c.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Get-Item &#8220;C:\\Windows\\System32\\notepad.exe&#8221;<\/span><span style=\"font-weight: 400;\"> s\u1ebd hi\u1ec3n th\u1ecb th\u00f4ng tin v\u1ec1 t\u1ec7p Notepad.<\/span><\/p>\n<h4><b>Get-ChildItem<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 t\u1ec7p v\u00e0 th\u01b0 m\u1ee5c con trong m\u1ed9t th\u01b0 m\u1ee5c.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Get-ChildItem &#8220;C:\\Users&#8221;<\/span><span style=\"font-weight: 400;\"> s\u1ebd hi\u1ec3n th\u1ecb danh s\u00e1ch t\u1ec7p trong th\u01b0 m\u1ee5c Users.<\/span><\/p>\n<h4><b>New-Item<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">H\u1ed7 tr\u1ee3 t\u1ea1o t\u1ec7p ho\u1eb7c th\u01b0 m\u1ee5c m\u1edbi trong h\u1ec7 th\u1ed1ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: N\u1ebfu b\u1ea1n mu\u1ed1n t\u1ea1o m\u1ed9t t\u1ec7p nh\u1eadt k\u00fd, l\u1ec7nh <\/span><span style=\"font-weight: 400;\">New-Item -Path &#8220;C:\\Scripts\\log.txt&#8221; -ItemType File<\/span><span style=\"font-weight: 400;\"> s\u1ebd t\u1ea1o t\u1ec7p <\/span><span style=\"font-weight: 400;\">log.txt<\/span><span style=\"font-weight: 400;\"> trong th\u01b0 m\u1ee5c <\/span><span style=\"font-weight: 400;\">C:\\Scripts<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4><b>Copy-Item<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Sao ch\u00e9p t\u1ec7p ho\u1eb7c th\u01b0 m\u1ee5c t\u1eeb v\u1ecb tr\u00ed n\u00e0y sang v\u1ecb tr\u00ed kh\u00e1c.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Copy-Item -Path &#8220;C:\\Data\\report.xlsx&#8221; -Destination &#8220;D:\\Backup\\&#8221;<\/span><span style=\"font-weight: 400;\"> s\u1ebd sao ch\u00e9p t\u1ec7p <\/span><span style=\"font-weight: 400;\">report.xlsx<\/span><span style=\"font-weight: 400;\"> t\u1eeb th\u01b0 m\u1ee5c <\/span><span style=\"font-weight: 400;\">C:\\Data<\/span><span style=\"font-weight: 400;\"> sang <\/span><span style=\"font-weight: 400;\">D:\\Backup<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4><b>Move-Item<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">H\u1ed7 tr\u1ee3 di chuy\u1ec3n ho\u1eb7c \u0111\u1ed5i t\u00ean t\u1ec7p\/th\u01b0 m\u1ee5c.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Move-Item -Path &#8220;C:\\Data\\old_report.xlsx&#8221; -Destination &#8220;C:\\Data\\new_report.xlsx&#8221;<\/span><span style=\"font-weight: 400;\"> s\u1ebd \u0111\u1ed5i t\u00ean t\u1ec7p <\/span><span style=\"font-weight: 400;\">old_report.xlsx<\/span><span style=\"font-weight: 400;\"> th\u00e0nh <\/span><span style=\"font-weight: 400;\">new_report.xlsx<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4><b>Remove-Item<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">X\u00f3a t\u1ec7p ho\u1eb7c th\u01b0 m\u1ee5c m\u1ed9t c\u00e1ch nhanh ch\u00f3ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: Khi s\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">Remove-Item -Path &#8220;C:\\Scripts\\log.txt&#8221; -Force<\/span><span style=\"font-weight: 400;\">, t\u1ec7p <\/span><span style=\"font-weight: 400;\">log.txt<\/span><span style=\"font-weight: 400;\"> s\u1ebd b\u1ecb x\u00f3a m\u00e0 kh\u00f4ng c\u1ea7n x\u00e1c nh\u1eadn, gi\u00fap ti\u1ebft ki\u1ec7m th\u1eddi gian khi qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng.<\/span><\/p>\n<h3><b>Nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell \u0111\u1ec3 qu\u1ea3n tr\u1ecb h\u1ec7 th\u1ed1ng<\/b><\/h3>\n<h4><b>Invoke-Command<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Th\u1ef1c thi l\u1ec7nh tr\u00ean m\u1ed9t ho\u1eb7c nhi\u1ec1u m\u00e1y t\u00ednh t\u1eeb xa, gi\u00fap qu\u1ea3n tr\u1ecb vi\u00ean d\u1ec5 d\u00e0ng ki\u1ec3m tra v\u00e0 qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng m\u00e0 kh\u00f4ng c\u1ea7n truy c\u1eadp tr\u1ef1c ti\u1ebfp.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Invoke-Command -ComputerName Server01 -ScriptBlock { Get-Service }<\/span><span style=\"font-weight: 400;\"> s\u1ebd ch\u1ea1y l\u1ec7nh <\/span><span style=\"font-weight: 400;\">Get-Service<\/span><span style=\"font-weight: 400;\"> tr\u00ean m\u00e1y ch\u1ee7 <\/span><span style=\"font-weight: 400;\">Server01 <\/span><span style=\"font-weight: 400;\">v\u00e0 tr\u1ea3 v\u1ec1 danh s\u00e1ch d\u1ecbch v\u1ee5 \u0111ang ch\u1ea1y.<\/span><\/p>\n<h4><b>Set-ExecutionPolicy<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">C\u1ea5u h\u00ecnh quy\u1ec1n th\u1ef1c thi script PowerShell. (Ch\u1ec9 \u00e1p d\u1ee5ng tr\u00ean Windows, kh\u00f4ng c\u00f3 tr\u00ean macOS v\u00e0 Linux).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Set-ExecutionPolicy RemoteSigned<\/span><span style=\"font-weight: 400;\"> cho ph\u00e9p ch\u1ea1y script \u0111\u01b0\u1ee3c k\u00fd s\u1ed1 t\u1eeb xa.<\/span><\/p>\n<h3><b>Nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell \u0111\u1ec3 qu\u1ea3n l\u00fd d\u1eef li\u1ec7u<\/b><\/h3>\n<h4><b>Export-CSV<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Xu\u1ea5t d\u1eef li\u1ec7u ra t\u1ec7p CSV \u0111\u1ec3 x\u1eed l\u00fd ho\u1eb7c ph\u00e2n t\u00edch sau n\u00e0y.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: Khi b\u1ea1n ch\u1ea1y <\/span><span style=\"font-weight: 400;\">Get-Process | Export-CSV -Path &#8220;C:\\Data\\processes.csv&#8221; -NoTypeInformation<\/span><span style=\"font-weight: 400;\">, danh s\u00e1ch ti\u1ebfn tr\u00ecnh \u0111ang ch\u1ea1y s\u1ebd \u0111\u01b0\u1ee3c l\u01b0u v\u00e0o t\u1ec7p <\/span><span style=\"font-weight: 400;\">processes.csv<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4><b>Import-CSV<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Nh\u1eadp d\u1eef li\u1ec7u t\u1eeb t\u1ec7p CSV v\u00e0o PowerShell \u0111\u1ec3 x\u1eed l\u00fd.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Import-CSV -Path &#8220;C:\\Data\\users.csv&#8221;<\/span><span style=\"font-weight: 400;\"> s\u1ebd \u0111\u1ecdc d\u1eef li\u1ec7u t\u1eeb <\/span><span style=\"font-weight: 400;\">users.csv<\/span><span style=\"font-weight: 400;\"> v\u00e0 hi\u1ec3n th\u1ecb n\u1ed9i dung d\u01b0\u1edbi d\u1ea1ng \u0111\u1ed1i t\u01b0\u1ee3ng PowerShell.<\/span><\/p>\n<h3><b>Nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell li\u00ean quan m\u1ea1ng<\/b><\/h3>\n<h4><b>Test-Connection<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">C\u00e2u l\u1ec7nh n\u00e0y ho\u1ea1t \u0111\u1ed9ng gi\u1ed1ng nh\u01b0 l\u1ec7nh <\/span><span style=\"font-weight: 400;\">ping<\/span><span style=\"font-weight: 400;\">, gi\u00fap ki\u1ec3m tra k\u1ebft n\u1ed1i m\u1ea1ng gi\u1eefa m\u00e1y t\u00ednh c\u1ee7a b\u1ea1n v\u00e0 m\u00e1y ch\u1ee7 t\u1eeb xa.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Test-Connection -ComputerName google.com -Count 4<\/span><span style=\"font-weight: 400;\"> s\u1ebd g\u1eedi 4 g\u00f3i tin \u0111\u1ebfn <\/span><i><span style=\"font-weight: 400;\">google.com<\/span><\/i><span style=\"font-weight: 400;\"> \u0111\u1ec3 ki\u1ec3m tra \u0111\u1ed9 ph\u1ea3n h\u1ed3i m\u1ea1ng.<\/span><\/p>\n<h4><b>Test-NetConnection<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Ki\u1ec3m tra k\u1ebft n\u1ed1i m\u1ea1ng, bao g\u1ed3m c\u1ea3 ki\u1ec3m tra c\u1ed5ng v\u00e0 truy v\u1ea5n TCP\/IP.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Test-NetConnection -ComputerName google.com -Port 443<\/span><span style=\"font-weight: 400;\"> L\u1ec7nh n\u00e0y ki\u1ec3m tra k\u1ebft n\u1ed1i TCP \u0111\u1ebfn <\/span><i><span style=\"font-weight: 400;\">google.com<\/span><\/i><span style=\"font-weight: 400;\"> tr\u00ean c\u1ed5ng 443 (HTTPS), gi\u00fap x\u00e1c \u0111\u1ecbnh xem c\u1ed5ng c\u00f3 m\u1edf hay kh\u00f4ng.<\/span><\/p>\n<h4><b>Get-NetAdapter<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Hi\u1ec3n th\u1ecb danh s\u00e1ch c\u00e1c card m\u1ea1ng tr\u00ean h\u1ec7 th\u1ed1ng, gi\u00fap ki\u1ec3m tra tr\u1ea1ng th\u00e1i v\u00e0 th\u00f4ng tin c\u1ee7a card m\u1ea1ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: L\u1ec7nh <\/span><span style=\"font-weight: 400;\">Get-NetAdapter<\/span><span style=\"font-weight: 400;\"> li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 c\u00e1c adapter m\u1ea1ng, hi\u1ec3n th\u1ecb tr\u1ea1ng th\u00e1i (<\/span><span style=\"font-weight: 400;\">Up<\/span><span style=\"font-weight: 400;\"> ho\u1eb7c <\/span><span style=\"font-weight: 400;\">Down<\/span><span style=\"font-weight: 400;\">) v\u00e0 th\u00f4ng tin chi ti\u1ebft.<\/span><\/p>\n<h3><b>Nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell \u0111\u1ec3 ki\u1ec3m tra nh\u1eadt k\u00fd s\u1ef1 ki\u1ec7n<\/b><\/h3>\n<h4><b>Get-EventLog<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Ki\u1ec3m tra nh\u1eadt k\u00fd h\u1ec7 th\u1ed1ng, gi\u00fap ch\u1ea9n \u0111o\u00e1n l\u1ed7i nhanh ch\u00f3ng.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <\/span><span style=\"font-weight: 400;\">Get-EventLog -LogName System -Newest 10<\/span><span style=\"font-weight: 400;\"> s\u1ebd hi\u1ec3n th\u1ecb 10 s\u1ef1 ki\u1ec7n h\u1ec7 th\u1ed1ng m\u1edbi nh\u1ea5t, gi\u00fap b\u1ea1n theo d\u00f5i ho\u1ea1t \u0111\u1ed9ng c\u1ee7a h\u1ec7 th\u1ed1ng.<\/span><\/p>\n<h4><b>Get-WinEvent<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">C\u00e2u l\u1ec7nh n\u00e0y l\u00e0 phi\u00ean b\u1ea3n n\u00e2ng cao c\u1ee7a <\/span><span style=\"font-weight: 400;\">Get-EventLog<\/span><span style=\"font-weight: 400;\">, h\u1ed7 tr\u1ee3 truy xu\u1ea5t nh\u1eadt k\u00fd s\u1ef1 ki\u1ec7n theo nhi\u1ec1u b\u1ed9 l\u1ecdc kh\u00e1c nhau.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <\/span><span style=\"font-weight: 400;\">Get-WinEvent -LogName Security -MaxEvents 10<\/span><span style=\"font-weight: 400;\"> l\u1ea5y 10 s\u1ef1 ki\u1ec7n b\u1ea3o m\u1eadt (Security) g\u1ea7n nh\u1ea5t, gi\u00fap theo d\u00f5i c\u00e1c s\u1ef1 ki\u1ec7n \u0111\u0103ng nh\u1eadp, quy\u1ec1n truy c\u1eadp h\u1ec7 th\u1ed1ng,&#8230;<\/span><\/p>\n<blockquote><p><span style=\"font-weight: 400;\">*L\u01b0u \u00fd: C\u00e1c cmdlet PowerShell c\u00f3 ch\u1ee9a &#8216;EventLog&#8217; ch\u1ec9 ho\u1ea1t \u0111\u1ed9ng v\u1edbi c\u00e1c nh\u1eadt k\u00fd s\u1ef1 ki\u1ec7n ki\u1ec3u c\u0169 c\u1ee7a Windows nh\u01b0 Application, System ho\u1eb7c Security. N\u1ebfu b\u1ea1n c\u1ea7n truy xu\u1ea5t nh\u1eadt k\u00fd s\u1ef1 ki\u1ec7n tr\u00ean Windows Vista tr\u1edf l\u00ean (s\u1eed d\u1ee5ng c\u00f4ng ngh\u1ec7 Windows Event Log m\u1edbi h\u01a1n), h\u00e3y d\u00f9ng <\/span><b>Get-WinEvent<\/b><span style=\"font-weight: 400;\"> thay v\u00ec <\/span><b>Get-EventLog<\/b><span style=\"font-weight: 400;\">.<\/span><\/p><\/blockquote>\n<h3><b>Nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell \u0111\u1ec3 qu\u1ea3n l\u00fd ti\u1ebfn tr\u00ecnh n\u1ec1n<\/b><\/h3>\n<h4><b>Start-Job<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Ch\u1ea1y m\u1ed9t l\u1ec7nh trong n\u1ec1n m\u00e0 kh\u00f4ng l\u00e0m gi\u00e1n \u0111o\u1ea1n qu\u00e1 tr\u00ecnh l\u00e0m vi\u1ec7c hi\u1ec7n t\u1ea1i.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: Khi ch\u1ea1y <\/span><span style=\"font-weight: 400;\">Start-Job -ScriptBlock { Get-Process }<\/span><span style=\"font-weight: 400;\">, PowerShell s\u1ebd th\u1ef1c thi <\/span><span style=\"font-weight: 400;\">Get-Process<\/span><span style=\"font-weight: 400;\"> trong n\u1ec1n, gi\u00fap b\u1ea1n ti\u1ebfp t\u1ee5c l\u00e0m vi\u1ec7c m\u00e0 kh\u00f4ng c\u1ea7n \u0111\u1ee3i l\u1ec7nh ho\u00e0n th\u00e0nh.<\/span><\/p>\n<h4><b>Get-Job<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Hi\u1ec3n th\u1ecb danh s\u00e1ch c\u00e1c ti\u1ebfn tr\u00ecnh n\u1ec1n \u0111ang ch\u1ea1y v\u00e0 tr\u1ea1ng th\u00e1i c\u1ee7a ch\u00fang.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <\/span><span style=\"font-weight: 400;\">Get-Job<\/span><span style=\"font-weight: 400;\"> li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 c\u00e1c c\u00f4ng vi\u1ec7c n\u1ec1n \u0111ang ch\u1ea1y, bao g\u1ed3m ID, tr\u1ea1ng th\u00e1i (Running, Completed, Failed).<\/span><\/p>\n<h4><b>Receive-Job<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">L\u1ea5y k\u1ebft qu\u1ea3 t\u1eeb m\u1ed9t ti\u1ebfn tr\u00ecnh n\u1ec1n \u0111\u00e3 ho\u00e0n th\u00e0nh.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5: <\/span><span style=\"font-weight: 400;\">Receive-Job -Id 1<\/span><span style=\"font-weight: 400;\"> l\u1ea5y k\u1ebft qu\u1ea3 t\u1eeb ti\u1ebfn tr\u00ecnh n\u1ec1n c\u00f3 ID 1. \u0110i\u1ec1u n\u00e0y gi\u00fap truy xu\u1ea5t k\u1ebft qu\u1ea3 sau khi ti\u1ebfn tr\u00ecnh \u0111\u00e3 ch\u1ea1y xong.<\/span><\/p>\n<h3><b>T\u00f3m t\u1eaft t\u00ednh n\u0103ng ch\u00ednh c\u1ee7a nh\u00f3m c\u00e1c l\u1ec7nh trong Powershell<\/b><\/h3>\n<table>\n<tbody>\n<tr>\n<td><b>Nh\u00f3m<\/b><\/td>\n<td><b>C\u00e2u l\u1ec7nh<\/b><\/td>\n<td><b>M\u00f4 t\u1ea3 ng\u1eafn g\u1ecdn<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Nh\u00f3m c\u00e2u l\u1ec7nh tr\u1ee3 gi\u00fap<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Get-Help<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Get-Command<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Get-Alias<\/span><\/td>\n<td><span style=\"font-weight: 400;\">H\u1ed7 tr\u1ee3 t\u00ecm ki\u1ebfm v\u00e0 hi\u1ec3n th\u1ecb th\u00f4ng tin v\u1ec1 cmdlet.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Nh\u00f3m c\u00e2u l\u1ec7nh th\u00f4ng tin &amp; qu\u1ea3n tr\u1ecb<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Get-Process<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Stop-Process<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Get-Service<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Start-Service<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Qu\u1ea3n l\u00fd ti\u1ebfn tr\u00ecnh v\u00e0 d\u1ecbch v\u1ee5 tr\u00ean h\u1ec7 th\u1ed1ng.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Nh\u00f3m qu\u1ea3n l\u00fd t\u1eadp tin &amp; th\u01b0 m\u1ee5c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Get-ChildItem<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Copy-Item<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Move-Item<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Remove-Item<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Qu\u1ea3n l\u00fd t\u1eadp tin v\u00e0 th\u01b0 m\u1ee5c tr\u00ean h\u1ec7 th\u1ed1ng.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Nh\u00f3m qu\u1ea3n tr\u1ecb h\u1ec7 th\u1ed1ng<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Invoke-Command<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Set-ExecutionPolicy<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Qu\u1ea3n l\u00fd l\u1ec7nh t\u1eeb xa v\u00e0 thi\u1ebft l\u1eadp quy\u1ec1n th\u1ef1c thi script.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Nh\u00f3m qu\u1ea3n l\u00fd d\u1eef li\u1ec7u<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Export-Csv<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Import-Csv<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Xu\u1ea5t v\u00e0 nh\u1eadp d\u1eef li\u1ec7u d\u01b0\u1edbi d\u1ea1ng CSV.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Nh\u00f3m li\u00ean quan m\u1ea1ng<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Test-Connection<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Test-NetConnection<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Get-NetAdapter<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Ki\u1ec3m tra k\u1ebft n\u1ed1i m\u1ea1ng, ki\u1ec3m tra c\u1ed5ng, th\u00f4ng tin card m\u1ea1ng.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Nh\u00f3m ki\u1ec3m tra nh\u1eadt k\u00fd s\u1ef1 ki\u1ec7n<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Get-EventLog<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Get-WinEvent<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Truy xu\u1ea5t th\u00f4ng tin t\u1eeb nh\u1eadt k\u00fd s\u1ef1 ki\u1ec7n Windows.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Nh\u00f3m qu\u1ea3n l\u00fd ti\u1ebfn tr\u00ecnh n\u1ec1n<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Start-Job<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Get-Job<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Receive-Job<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Ch\u1ea1y ti\u1ebfn tr\u00ecnh trong n\u1ec1n, ki\u1ec3m tra v\u00e0 l\u1ea5y k\u1ebft qu\u1ea3 c\u00f4ng vi\u1ec7c.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span class=\"ez-toc-section\" id=\"Meo_su_dung_cac_lenh_trong_Powershell_hieu_qua_hon\"><\/span><b>M\u1eb9o s\u1eed d\u1ee5ng c\u00e1c l\u1ec7nh trong Powershell hi\u1ec7u qu\u1ea3 h\u01a1n<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>Hi\u1ec3u c\u1ea5u tr\u00fac c\u01a1 b\u1ea3n c\u1ee7a c\u00e1c l\u1ec7nh trong Powershell<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1edbc khi kh\u00e1m ph\u00e1 c\u00e1c l\u1ec7nh n\u00e2ng cao, b\u1ea1n c\u1ea7n n\u1eafm v\u1eefng c\u00fa ph\u00e1p v\u00e0 c\u1ea5u tr\u00fac c\u01a1 b\u1ea3n c\u1ee7a PowerShell. C\u00e1c l\u1ec7nh trong PowerShell g\u1ecdi l\u00e0 cmdlet (\u0111\u1ecdc l\u00e0 &#8220;command-lets&#8221;) c\u00f3 d\u1ea1ng:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">\u0110\u1ed9ng_t\u1eeb-Danh_t\u1eeb [-ThamS\u1ed1 Gi\u00e1Tr\u1ecb]<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5, \u0111\u1ec3 li\u1ec7t k\u00ea t\u1ea5t c\u1ea3 c\u00e1c t\u1ec7p trong th\u01b0 m\u1ee5c, b\u1ea1n d\u00f9ng:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Get-ChildItem C:\\Path\\To\\Directory<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Hi\u1ec3u r\u00f5 c\u00e1c \u0111\u1ed9ng t\u1eeb th\u00f4ng d\u1ee5ng nh\u01b0 <\/span><span style=\"font-weight: 400;\">Get<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Set<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">New<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">Remove <\/span><span style=\"font-weight: 400;\">gi\u00fap b\u1ea1n thao t\u00e1c nhanh h\u01a1n trong m\u00f4i tr\u01b0\u1eddng Windows:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Get: L\u1ea5y th\u00f4ng tin (v\u00ed d\u1ee5: Get-Process)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Set: Thi\u1ebft l\u1eadp gi\u00e1 tr\u1ecb (v\u00ed d\u1ee5: Set-ExecutionPolicy)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">New: T\u1ea1o m\u1edbi m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng (v\u00ed d\u1ee5: New-Item)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Remove: X\u00f3a \u0111\u1ed1i t\u01b0\u1ee3ng (v\u00ed d\u1ee5: Remove-Item)<\/span><\/li>\n<\/ul>\n<h3><b>T\u1eadn d\u1ee5ng PowerShell Pipeline \u0111\u1ec3 x\u1eed l\u00fd d\u1eef li\u1ec7u<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Pipeline <\/span><span style=\"font-weight: 400;\">(|)<\/span><span style=\"font-weight: 400;\"> l\u00e0 m\u1ed9t trong nh\u1eefng t\u00ednh n\u0103ng m\u1ea1nh nh\u1ea5t c\u1ee7a PowerShell, cho ph\u00e9p b\u1ea1n truy\u1ec1n \u0111\u1ea7u ra c\u1ee7a m\u1ed9t cmdlet th\u00e0nh \u0111\u1ea7u v\u00e0o c\u1ee7a cmdlet kh\u00e1c, gi\u00fap x\u1eed l\u00fd d\u1eef li\u1ec7u nhanh ch\u00f3ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5, \u0111\u1ec3 t\u00ecm t\u1ea5t c\u1ea3 c\u00e1c t\u1ec7p<\/span> <span style=\"font-weight: 400;\">.txt<\/span><span style=\"font-weight: 400;\"> trong th\u01b0 m\u1ee5c v\u00e0 hi\u1ec3n th\u1ecb n\u1ed9i dung c\u1ee7a ch\u00fang, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Get-ChildItem -Path C:\\Path\\To\\Directory -Filter *.txt | Get-Content<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Pipeline gi\u00fap gi\u1ea3m thi\u1ec3u c\u00e1c thao t\u00e1c th\u1ee7 c\u00f4ng v\u00e0 t\u1ed1i \u01b0u h\u00f3a quy tr\u00ecnh l\u00e0m vi\u1ec7c.<\/span><\/p>\n<h3><b>Qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng t\u1eeb xa b\u1eb1ng PowerShell<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">N\u1ebfu b\u1ea1n \u0111ang l\u00e0m vi\u1ec7c v\u1edbi nhi\u1ec1u m\u00e1y t\u00ednh trong h\u1ec7 th\u1ed1ng m\u1ea1ng, PowerShell h\u1ed7 tr\u1ee3 qu\u1ea3n l\u00fd t\u1eeb xa th\u00f4ng qua cmdlet<\/span> <span style=\"font-weight: 400;\">Invoke-Command<\/span><span style=\"font-weight: 400;\">. \u0110i\u1ec1u n\u00e0y gi\u00fap b\u1ea1n th\u1ef1c thi l\u1ec7nh m\u00e0 kh\u00f4ng c\u1ea7n k\u1ebft n\u1ed1i Remote Desktop.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5, \u0111\u1ec3 ch\u1ea1y l\u1ec7nh tr\u00ean m\u00e1y t\u00ednh t\u1eeb xa:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Invoke-Command -ComputerName RemotePC -ScriptBlock { Get-Service }<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 k\u1ebft h\u1ee3p v\u1edbi <\/span><span style=\"font-weight: 400;\">-Credential<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 x\u00e1c th\u1ef1c t\u00e0i kho\u1ea3n qu\u1ea3n tr\u1ecb vi\u00ean khi c\u1ea7n.<\/span><\/p>\n<h3><b>T\u1ef1 \u0111\u1ed9ng h\u00f3a c\u00f4ng vi\u1ec7c b\u1eb1ng PowerShell Script<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">PowerShell h\u1ed7 tr\u1ee3 t\u1ea1o script t\u1ef1 \u0111\u1ed9ng h\u00f3a, gi\u00fap b\u1ea1n ti\u1ebft ki\u1ec7m th\u1eddi gian cho c\u00e1c t\u00e1c v\u1ee5 l\u1eb7p \u0111i l\u1eb7p l\u1ea1i. \u0110\u1ec3 t\u1ea1o script, h\u00e3y l\u01b0u file v\u1edbi \u0111\u1ecbnh d\u1ea1ng <\/span><span style=\"font-weight: 400;\">.ps1<\/span><span style=\"font-weight: 400;\"> v\u00e0 ch\u1ea1y b\u1eb1ng PowerShell ISE ho\u1eb7c VS Code.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1edbc khi ch\u1ea1y, h\u00e3y thi\u1ebft l\u1eadp ch\u00ednh s\u00e1ch th\u1ef1c thi v\u1edbi l\u1ec7nh:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Set-ExecutionPolicy RemoteSigned<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Sau \u0111\u00f3, ch\u1ea1y script v\u1edbi:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">.\\MyScript.ps1<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Vi\u1ec7c s\u1eed d\u1ee5ng script gi\u00fap gi\u1ea3m thi\u1ec3u sai s\u00f3t v\u00e0 t\u1ed1i \u01b0u h\u00f3a quy tr\u00ecnh v\u1eadn h\u00e0nh.<\/span><\/p>\n<h3><b>T\u1eadn d\u1ee5ng h\u1ec7 th\u1ed1ng tr\u1ee3 gi\u00fap PowerShell<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">PowerShell cung c\u1ea5p h\u1ec7 th\u1ed1ng t\u00e0i li\u1ec7u h\u1ed7 tr\u1ee3 m\u1ea1nh m\u1ebd. N\u1ebfu c\u1ea7n t\u00ecm hi\u1ec3u v\u1ec1 m\u1ed9t cmdlet c\u1ee5 th\u1ec3, b\u1ea1n ch\u1ec9 c\u1ea7n s\u1eed d\u1ee5ng l\u1ec7nh:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Get-Help Get-Process<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">H\u1ec7 th\u1ed1ng tr\u1ee3 gi\u00fap s\u1ebd hi\u1ec3n th\u1ecb h\u01b0\u1edbng d\u1eabn, v\u00ed d\u1ee5 s\u1eed d\u1ee5ng v\u00e0 th\u00f4ng tin tham s\u1ed1, gi\u00fap b\u1ea1n nhanh ch\u00f3ng n\u1eafm b\u1eaft ki\u1ebfn th\u1ee9c.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, b\u1ea1n c\u00f3 th\u1ec3 t\u00ecm ki\u1ebfm t\u00e0i nguy\u00ean t\u1eeb c\u1ed9ng \u0111\u1ed3ng PowerShell, c\u00e1c blog chuy\u00ean s\u00e2u v\u00e0 di\u1ec5n \u0111\u00e0n c\u00f4ng ngh\u1ec7 \u0111\u1ec3 c\u1eadp nh\u1eadt ki\u1ebfn th\u1ee9c m\u1edbi nh\u1ea5t.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_thuong_gap_ve_cac_lenh_trong_Powershell\"><\/span><b>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 c\u00e1c l\u1ec7nh trong Powershell<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><b>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 l\u01b0u l\u1ea1i l\u1ecbch s\u1eed c\u00e1c l\u1ec7nh trong Powershell \u0111\u00e3 nh\u1eadp?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 l\u01b0u l\u1ea1i l\u1ecbch s\u1eed c\u00e1c l\u1ec7nh \u0111\u00e3 nh\u1eadp trong PowerShell b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng l\u1ec7nh Get-History \u0111\u1ec3 hi\u1ec3n th\u1ecb danh s\u00e1ch c\u00e1c l\u1ec7nh \u0111\u00e3 ch\u1ea1y trong phi\u00ean hi\u1ec7n t\u1ea1i.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 l\u01b0u l\u1ecbch s\u1eed v\u00e0o t\u1ec7p, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng:\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Get-History | Export-Csv C:\\history.csv -NoTypeInformation<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, PowerShell c\u0169ng l\u01b0u l\u1ecbch s\u1eed phi\u00ean g\u1ea7n \u0111\u00e2y trong t\u1ec7p <\/span><span style=\"font-weight: 400;\">ConsoleHost_history.txt<\/span><span style=\"font-weight: 400;\">, n\u1eb1m t\u1ea1i th\u01b0 m\u1ee5c <\/span><span style=\"font-weight: 400;\">%APPDATA%\\Microsoft\\Windows\\PowerShell\\PSReadLine\\<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h3><b>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 xem th\u00f4ng tin chi ti\u1ebft v\u1ec1 m\u1ed9t l\u1ec7nh PowerShell?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 xem th\u00f4ng tin chi ti\u1ebft v\u1ec1 m\u1ed9t l\u1ec7nh PowerShell b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng cmdlet <\/span><span style=\"font-weight: 400;\">Get-Help<\/span><span style=\"font-weight: 400;\"> theo sau l\u00e0 t\u00ean l\u1ec7nh. V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Get-Help Get-Process<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 hi\u1ec3n th\u1ecb h\u01b0\u1edbng d\u1eabn chi ti\u1ebft h\u01a1n, bao g\u1ed3m v\u00ed d\u1ee5 s\u1eed d\u1ee5ng, b\u1ea1n c\u00f3 th\u1ec3 th\u00eam tham s\u1ed1 <\/span><span style=\"font-weight: 400;\">-Detailed<\/span><span style=\"font-weight: 400;\"> ho\u1eb7c <\/span><span style=\"font-weight: 400;\">-Examples<\/span><span style=\"font-weight: 400;\">, ch\u1eb3ng h\u1ea1n:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Get-Help Get-Process -Detailed<\/span><\/pre>\n<h3><b>L\u00e0m sao \u0111\u1ec3 ch\u1ea1y nhi\u1ec1u l\u1ec7nh PowerShell c\u00f9ng l\u00fac?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 ch\u1ea1y nhi\u1ec1u l\u1ec7nh PowerShell c\u00f9ng l\u00fac b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng d\u1ea5u ch\u1ea5m ph\u1ea9y (<\/span><span style=\"font-weight: 400;\">;<\/span><span style=\"font-weight: 400;\">) \u0111\u1ec3 t\u00e1ch c\u00e1c l\u1ec7nh trong c\u00f9ng m\u1ed9t d\u00f2ng. V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Get-Process; Get-Service<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng d\u1ea5u <\/span><span style=\"font-weight: 400;\">&amp;&amp;<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 ch\u1ec9 ch\u1ea1y l\u1ec7nh ti\u1ebfp theo n\u1ebfu l\u1ec7nh tr\u01b0\u1edbc \u0111\u00f3 th\u00e0nh c\u00f4ng ho\u1eb7c d\u00f9ng <\/span><span style=\"font-weight: 400;\">|<\/span><span style=\"font-weight: 400;\"> (pipeline) \u0111\u1ec3 truy\u1ec1n \u0111\u1ea7u ra t\u1eeb l\u1ec7nh n\u00e0y sang l\u1ec7nh kh\u00e1c.<\/span><\/p>\n<h3><b>L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 t\u1ea1m d\u1eebng th\u1ef1c thi l\u1ec7nh trong PowerShell?<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 t\u1ea1m d\u1eebng th\u1ef1c thi l\u1ec7nh trong PowerShell b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng l\u1ec7nh <\/span><span style=\"font-weight: 400;\">Start-Sleep<\/span><span style=\"font-weight: 400;\"> v\u00e0 ch\u1ec9 \u0111\u1ecbnh th\u1eddi gian t\u1ea1m d\u1eebng (t\u00ednh b\u1eb1ng gi\u00e2y). V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Start-Sleep -Seconds 5<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, n\u1ebfu \u0111ang ch\u1ea1y m\u1ed9t script, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">Read-Host<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 ch\u1edd ng\u01b0\u1eddi d\u00f9ng nh\u1eadp d\u1eef li\u1ec7u tr\u01b0\u1edbc khi ti\u1ebfp t\u1ee5c:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">Read-Host \"Nh\u1ea5n Enter \u0111\u1ec3 ti\u1ebfp t\u1ee5c\"<\/span><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Tong_ket_cac_lenh_trong_Powershell\"><\/span><b>T\u1ed5ng k\u1ebft c\u00e1c l\u1ec7nh trong Powershell<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Vi\u1ec7c th\u00e0nh th\u1ea1o c\u00e1c l\u1ec7nh trong PowerShell kh\u00f4ng ch\u1ec9 gi\u00fap b\u1ea1n qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng hi\u1ec7u qu\u1ea3 m\u00e0 c\u00f2n t\u1ef1 \u0111\u1ed9ng h\u00f3a nhi\u1ec1u t\u00e1c v\u1ee5 quan tr\u1ecdng. D\u00f9 l\u00e0 ng\u01b0\u1eddi m\u1edbi hay \u0111\u00e3 c\u00f3 kinh nghi\u1ec7m, vi\u1ec7c th\u1ef1c h\u00e0nh th\u01b0\u1eddng xuy\u00ean s\u1ebd gi\u00fap b\u1ea1n l\u00e0m ch\u1ee7 c\u00f4ng c\u1ee5 n\u00e0y nhanh ch\u00f3ng. H\u00e3y \u00e1p d\u1ee5ng ngay nh\u1eefng l\u1ec7nh PowerShell h\u1eefu \u00edch \u0111\u1ec3 n\u00e2ng cao hi\u1ec7u su\u1ea5t l\u00e0m vi\u1ec7c c\u1ee7a b\u1ea1n!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\u00e1c c\u00e2u l\u1ec7nh trong PowerShell l\u00e0 c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd gi\u00fap t\u1ef1 \u0111\u1ed9ng h\u00f3a t\u00e1c v\u1ee5, qu\u1ea3n l\u00fd t\u1ec7p, th\u01b0 m\u1ee5c, ti\u1ebfn tr\u00ecnh v\u00e0 d\u1ecbch v\u1ee5 m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3. N\u1ebfu b\u1ea1n \u0111ang t\u00ecm ki\u1ebfm danh s\u00e1ch l\u1ec7nh PowerShell t\u1eeb c\u01a1 b\u1ea3n \u0111\u1ebfn n\u00e2ng cao \u0111\u1ec3 t\u1ed1i \u01b0u c\u00f4ng vi\u1ec7c, b\u00e0i vi\u1ebft n\u00e0y s\u1ebd cung [&hellip;]<\/p>\n","protected":false},"author":214,"featured_media":85392,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-85385","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Top 30+ c\u00e1c l\u1ec7nh trong Powershell ph\u1ed5 bi\u1ebfn nh\u1ea5t - ITviec Blog<\/title>\n<meta name=\"description\" content=\"T\u00ecm hi\u1ec3u c\u00e1c l\u1ec7nh trong Powershell gi\u00fap t\u1ef1 \u0111\u1ed9ng h\u00f3a t\u00e1c v\u1ee5, qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng hi\u1ec7u qu\u1ea3. Xem ngay ph\u00e2n lo\u1ea1i chi ti\u1ebft k\u00e8m v\u00ed d\u1ee5 th\u1ef1c t\u1ebf!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Top 30+ c\u00e1c l\u1ec7nh trong Powershell ph\u1ed5 bi\u1ebfn nh\u1ea5t\" \/>\n<meta property=\"og:description\" content=\"C\u00e1c c\u00e2u l\u1ec7nh trong PowerShell l\u00e0 c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd gi\u00fap t\u1ef1 \u0111\u1ed9ng h\u00f3a t\u00e1c v\u1ee5, qu\u1ea3n l\u00fd t\u1ec7p, th\u01b0 m\u1ee5c, ti\u1ebfn tr\u00ecnh v\u00e0 d\u1ecbch v\u1ee5 m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3. N\u1ebfu b\u1ea1n \u0111ang t\u00ecm\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-28T04:41:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-18T08:46:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/03\/cac-lenh-trong-powershell-vippro-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"337\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Hi\u1ebfu Phan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hi\u1ebfu Phan\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Top 30+ c\u00e1c l\u1ec7nh trong Powershell ph\u1ed5 bi\u1ebfn nh\u1ea5t - ITviec Blog","description":"T\u00ecm hi\u1ec3u c\u00e1c l\u1ec7nh trong Powershell gi\u00fap t\u1ef1 \u0111\u1ed9ng h\u00f3a t\u00e1c v\u1ee5, qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng hi\u1ec7u qu\u1ea3. Xem ngay ph\u00e2n lo\u1ea1i chi ti\u1ebft k\u00e8m v\u00ed d\u1ee5 th\u1ef1c t\u1ebf!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/","og_locale":"vi_VN","og_type":"article","og_title":"Top 30+ c\u00e1c l\u1ec7nh trong Powershell ph\u1ed5 bi\u1ebfn nh\u1ea5t","og_description":"C\u00e1c c\u00e2u l\u1ec7nh trong PowerShell l\u00e0 c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd gi\u00fap t\u1ef1 \u0111\u1ed9ng h\u00f3a t\u00e1c v\u1ee5, qu\u1ea3n l\u00fd t\u1ec7p, th\u01b0 m\u1ee5c, ti\u1ebfn tr\u00ecnh v\u00e0 d\u1ecbch v\u1ee5 m\u1ed9t c\u00e1ch hi\u1ec7u qu\u1ea3. N\u1ebfu b\u1ea1n \u0111ang t\u00ecm","og_url":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2025-03-28T04:41:32+00:00","article_modified_time":"2025-06-18T08:46:58+00:00","og_image":[{"width":640,"height":337,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/03\/cac-lenh-trong-powershell-vippro-scaled.png","type":"image\/png"}],"author":"Hi\u1ebfu Phan","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Hi\u1ebfu Phan","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"16 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/"},"author":{"name":"Hi\u1ebfu Phan","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/d9f4dfc3237d95eb1549e5adb2ede904"},"headline":"Top 30+ c\u00e1c l\u1ec7nh trong Powershell ph\u1ed5 bi\u1ebfn nh\u1ea5t","datePublished":"2025-03-28T04:41:32+00:00","dateModified":"2025-06-18T08:46:58+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/"},"wordCount":4348,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/03\/cac-lenh-trong-powershell-vippro-scaled.png","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/","url":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/","name":"Top 30+ c\u00e1c l\u1ec7nh trong Powershell ph\u1ed5 bi\u1ebfn nh\u1ea5t - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/03\/cac-lenh-trong-powershell-vippro-scaled.png","datePublished":"2025-03-28T04:41:32+00:00","dateModified":"2025-06-18T08:46:58+00:00","description":"T\u00ecm hi\u1ec3u c\u00e1c l\u1ec7nh trong Powershell gi\u00fap t\u1ef1 \u0111\u1ed9ng h\u00f3a t\u00e1c v\u1ee5, qu\u1ea3n l\u00fd h\u1ec7 th\u1ed1ng hi\u1ec7u qu\u1ea3. Xem ngay ph\u00e2n lo\u1ea1i chi ti\u1ebft k\u00e8m v\u00ed d\u1ee5 th\u1ef1c t\u1ebf!","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/03\/cac-lenh-trong-powershell-vippro-scaled.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2025\/03\/cac-lenh-trong-powershell-vippro-scaled.png","width":640,"height":337,"caption":"c\u00e1c l\u1ec7nh trong powershell - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/cac-lenh-trong-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"Top 30+ c\u00e1c l\u1ec7nh trong Powershell ph\u1ed5 bi\u1ebfn nh\u1ea5t"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/d9f4dfc3237d95eb1549e5adb2ede904","name":"Hi\u1ebfu Phan","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/phan-trung-hieu-author-e1709881921227-100x100.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/phan-trung-hieu-author-e1709881921227-100x100.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/phan-trung-hieu-author-e1709881921227-100x100.jpg","caption":"Hi\u1ebfu Phan"},"url":"https:\/\/itviec.com\/blog\/author\/hieu-phan\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/85385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/214"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=85385"}],"version-history":[{"count":1,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/85385\/revisions"}],"predecessor-version":[{"id":88161,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/85385\/revisions\/88161"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/85392"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=85385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=85385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=85385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}