{"id":19488,"date":"2021-01-28T03:56:06","date_gmt":"2021-01-28T03:56:06","guid":{"rendered":"https:\/\/hocvienit.vn\/?p=19488"},"modified":"2024-08-28T16:21:52","modified_gmt":"2024-08-28T09:21:52","slug":"tat-tan-tat-ve-powershell-nhung-kien-thuc-co-ban-ve-powershell","status":"publish","type":"post","link":"https:\/\/hocvienit.vn\/?p=19488","title":{"rendered":"T\u1ea5t t\u1ea7n t\u1eadt v\u1ec1 PowerShell &#8211; Nh\u1eefng ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 PowerShell"},"content":{"rendered":"<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\"><strong>Windows PowerShell<\/strong> l\u00e0 m\u1ed9t ti\u1ec7n \u00edch m\u1edbi c\u1ee7a Microsoft nh\u1eb1m thay th\u1ebf cho Command Prompt trong t\u01b0\u01a1ng lai. Th\u1ebf nh\u01b0ng b\u1ea1n c\u00f3 bi\u1ebft PowerShell l\u00e0 g\u00ec v\u00e0 nh\u1eefng ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 PowerShell hay ch\u01b0a? H\u00e3y c\u00f9ng t\u00ecm hi\u1ec3u chi ti\u1ebft trong b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y nh\u00e9.<\/span><\/p>\n<figure id=\"attachment_19489\" aria-describedby=\"caption-attachment-19489\" style=\"width: 750px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-19489 size-full\" title=\"T\u1ea5t t\u1ea7n t\u1eadt v\u1ec1 PowerShell - Nh\u1eefng ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 PowerShell\" src=\"https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/tat-tan-tat-ve-powershell-nhung-kien-thuc-co-ban-ve-powershell.jpg\" alt=\"T\u1ea5t t\u1ea7n t\u1eadt v\u1ec1 PowerShell - Nh\u1eefng ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 PowerShell\" width=\"750\" height=\"400\" srcset=\"https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/tat-tan-tat-ve-powershell-nhung-kien-thuc-co-ban-ve-powershell.jpg 750w, https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/tat-tan-tat-ve-powershell-nhung-kien-thuc-co-ban-ve-powershell-510x272.jpg 510w, https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/tat-tan-tat-ve-powershell-nhung-kien-thuc-co-ban-ve-powershell-300x160.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><figcaption id=\"caption-attachment-19489\" class=\"wp-caption-text\"><span style=\"font-size: 16px; color: #333333;\">T\u1ea5t t\u1ea7n t\u1eadt v\u1ec1 PowerShell &#8211; Nh\u1eefng ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 PowerShell<\/span><\/figcaption><\/figure>\n<h2 style=\"text-align: justify;\"><span style=\"font-size: 24px;\"><strong>PowerShell l\u00e0 g\u00ec?<\/strong><\/span><\/h2>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">PowerShell hay \u0111\u01b0\u1ee3c g\u1ecdi v\u1edbi c\u00e1i t\u00ean \u0111\u1ea7y \u0111\u1ee7 h\u01a1n l\u00e0 Microsoft PowerShell. \u0110\u00e2y l\u00e0 m\u1ed9t ti\u1ec7n \u00edch c\u1ee7a Microsoft gi\u00fap b\u1ea1n (C\u00e1c nh\u00e0 qu\u1ea3n tr\u1ecb) c\u00f3 th\u1ec3 \u0111\u01b0a ra c\u00e1c d\u00f2ng l\u1ec7nh v\u00e0 ng\u00f4n ng\u1eef k\u1ecbch b\u1ea3n \u0111\u1ec3 t\u1ef1 \u0111\u1ed9ng th\u1ef1c hi\u1ec7n h\u00e0ng lo\u1ea1t nhi\u1ec7m v\u1ee5 trong m\u00e1y t\u00ednh. PowerShell \u0111\u01b0\u1ee3c x\u00e2y d\u1ef1ng d\u1ef1a tr\u00ean n\u1ec1n t\u1ea3ng framework .NET v\u00e0 ch\u1ee9a c\u00e1c th\u00e0nh ph\u1ea7n c\u1ee7a Command Prompt.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Trong \u0111\u00f3, c\u00f3 r\u1ea5t nhi\u1ec1u c\u00e1ch \u0111\u1ec3 s\u1eed d\u1ee5ng PowerShell kh\u00e1c nhau nh\u1eb1m gi\u00fap ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 \u0111\u01a1n gi\u1ea3n h\u00f3a c\u00e1c c\u00f4ng vi\u1ec7c th\u01b0\u1eddng ng\u00e0y. \u0110\u1eb7c bi\u1ec7t, th\u00f4ng qua PowerShell, b\u1ea1n ho\u00e0n to\u00e0n c\u00f3 kh\u1ea3 n\u0103ng thay \u0111\u1ed5i to\u00e0n b\u1ed9 h\u1ec7 th\u1ed1ng ch\u1ee9 kh\u00f4ng c\u1ea7n ph\u1ea3i \u0111i\u1ec1u ch\u1ec9nh ri\u00eang l\u1ebb t\u1eebng y\u1ebfu t\u1ed1.<\/span><\/p>\n<h2 style=\"text-align: justify;\"><span style=\"font-size: 24px;\"><strong>Nh\u1eefng t\u00e1c d\u1ee5ng c\u01a1 b\u1ea3n c\u1ee7a PowerShell<\/strong><\/span><\/h2>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">C\u00e1c b\u1ea1n c\u00f3 th\u1ec3 th\u1ea5y, PowerShell c\u00f3 r\u1ea5t nhi\u1ec1u t\u00e1c d\u1ee5ng trong m\u00e1y t\u00ednh nh\u01b0ng c\u01a1 b\u1ea3n nh\u1ea5t v\u1eabn l\u00e0 nh\u1eefng t\u00e1c d\u1ee5ng sau \u0111\u00e2y:<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; T\u1ea1o b\u00e1o c\u00e1o cho nh\u1eefng ti\u1ebfn tr\u00ecnh hi\u1ec7n t\u1ea1i.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; D\u1ecbch v\u1ee5 theo chu k\u1ef3.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; L\u00ean l\u1ecbch c\u1eadp nh\u1eadt h\u00e0ng ng\u00e0y.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; T\u1ea1o script cho m\u1ed9t nhi\u1ec7m v\u1ee5 c\u1ee5 th\u1ec3&#8230; V\u00e0 nhi\u1ec1u t\u00e1c d\u1ee5ng kh\u00e1c.<\/span><\/p>\n<h2 style=\"text-align: justify;\"><span style=\"font-size: 24px;\"><strong>Nh\u1eefng kh\u00e1i ni\u1ec7m li\u00ean quan \u0111\u1ebfn PowerShell<\/strong><\/span><\/h2>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Trong b\u00e0i vi\u1ebft n\u00e0y, H\u1ecdc vi\u1ec7n iT.vn s\u1ebd gi\u1edbi thi\u1ec7u t\u1edbi c\u00e1c b\u1ea1n ba kh\u00e1i ni\u1ec7m c\u01a1 b\u1ea3n nh\u1ea5t li\u00ean quan \u0111\u1ebfn PowerShell \u0111\u00f3 l\u00e0 c\u00f4ng c\u1ee5, l\u1ec7nh v\u00e0 m\u00f4-\u0111un trong PowerShell.<\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">C\u00f4ng c\u1ee5 trong PowerShell<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">PowerShell \u0111\u01b0\u1ee3c c\u00e0i \u0111\u1eb7t m\u1eb7c \u0111\u1ecbnh v\u00e0 c\u1eadp nh\u1eadt th\u00eam nhi\u1ec1u t\u00ednh n\u0103ng m\u1edbi c\u0169ng nh\u01b0 c\u00e1c l\u1ec7nh (Cmdlets) theo c\u00e1c phi\u00ean b\u1ea3n t\u01b0\u01a1ng \u1ee9ng c\u1ee7a Windows Management Framework (WMF). Hi\u1ec7n t\u1ea1i, phi\u00ean b\u1ea3n m\u1edbi nh\u1ea5t v\u00e0 \u0111\u01b0\u1ee3c khuy\u1ebfn ngh\u1ecb s\u1eed d\u1ee5ng c\u1ee7a Windows Management Framework l\u00e0 WMF 5.1.\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Ngo\u00e0i WMP, m\u1ed9t s\u1ed1 t\u00ednh n\u0103ng m\u1edbi c\u1ee7a PowerShell c\u0169ng ph\u1ee5 thu\u1ed9c theo phi\u00ean b\u1ea3n c\u1ee7a h\u1ec7 \u0111i\u1ec1u h\u00e0nh. V\u00ed d\u1ee5 nh\u01b0 t\u00ednh n\u0103ng cmdlet Test-NetConnection \u0111\u01b0\u1ee3c h\u1ed7 tr\u1ee3 tr\u00ean Windows 8 v\u00e0 Windows Server 2012 nh\u01b0ng t\u00ednh n\u0103ng n\u00e0y l\u1ea1i kh\u00f4ng kh\u1ea3 d\u1ee5ng tr\u00ean Windows 7 k\u1ec3 c\u1ea3 khi b\u1ea1n c\u00e0i \u0111\u1eb7t phi\u00ean b\u1ea3n WMF m\u1edbi nh\u1ea5t.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Trong PowerShell, b\u1ea1n s\u1ebd \u0111\u01b0\u1ee3c trang b\u1ecb s\u1eb5n hai m\u00f4i tr\u01b0\u1eddng:<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; <strong>B\u1ea3ng \u0111i\u1ec1u khi\u1ec3n PowerShell:<\/strong> M\u00f4i tr\u01b0\u1eddng n\u00e0y gi\u1ed1ng nh\u01b0 d\u00f2ng l\u1ec7nh truy\u1ec1n th\u1ed1ng bao g\u1ed3m t\u00ean bi\u1ebfn, ho\u00e0n th\u00e0nh tab, v\u00f2ng l\u1eb7p v\u00e0 \u0111\u01b0\u1eddng \u1ed1ng.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; <strong>PowerShell ISE (M\u00f4i tr\u01b0\u1eddng t\u1eadp l\u1ec7nh t\u00edch h\u1ee3p):<\/strong> \u0110\u00e2y l\u00e0 m\u00f4i tr\u01b0\u1eddng gi\u00fap b\u1ea1n l\u00e0m vi\u1ec7c s\u00e2u h\u01a1n nh\u01b0 highlight code, ho\u00e0n t\u1ea5t tab hay ho\u00e0n t\u1ea5t code Intellisense. M\u00f4i tr\u01b0\u1eddng n\u00e0y c\u0169ng cho ph\u00e9p b\u1ea1n c\u00f3 kh\u1ea3 n\u0103ng s\u1eed d\u1ee5ng nhi\u1ec1u t\u1eadp l\u1ec7nh v\u00e0 \u0111i\u1ec1u h\u01b0\u1edbng theo tab.<\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">L\u1ec7nh trong PowerShell<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Cmdlet ch\u00ednh l\u00e0 n\u1ec1n t\u1ea3ng t\u1ea1o n\u00ean c\u00e1c l\u1ec7nh trong PowerShell. Nh\u1eb1m gi\u00fap ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng l\u1ec7nh m\u1ed9t c\u00e1ch \u0111\u01a1n gi\u1ea3n v\u00e0 d\u1ec5 d\u00e0ng nh\u1ea5t, cmdlet d\u00f9ng \u0111\u1ecbnh d\u1ea1ng Verb-Noun (\u0110\u1ed9ng t\u1eeb &#8211; Danh t\u1eeb). Trong \u0111\u00f3, ph\u1ea7n \u0111\u1ed9ng t\u1eeb trong l\u1ec7nh c\u00f3 vai tr\u00f2 ch\u1ec9 ra h\u00e0nh \u0111\u1ed9ng th\u1ef1c hi\u1ec7n tr\u00ean danh t\u1eeb. V\u00ed d\u1ee5, c\u00e1c l\u1ec7nh d\u00f9ng \u0111\u1ec3 ch\u1ec9nh s\u1eeda m\u1ed9t c\u00e1i g\u00ec \u0111\u00f3 th\u01b0\u1eddng \u0111\u01b0\u1ee3c b\u1eaft \u0111\u1ea7u b\u1eb1ng \u0111\u1ed9ng t\u1eeb Set.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Ti\u1ebfp theo, nh\u1eefng tham s\u1ed1 s\u1eed d\u1ee5ng trong PowerShell c\u0169ng \u0111\u01b0\u1ee3c \u0111\u1eb7t t\u00ean theo m\u1ed9t quy chu\u1ea9n nh\u1ea5t \u0111\u1ecbnh. V\u00ed d\u1ee5, tham s\u1ed1 -Credential d\u00f9ng \u0111\u1ec3 cung c\u1ea5p m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng x\u00e1c th\u1ef1c, ch\u1ee9a th\u00f4ng tin \u0111\u0103ng nh\u1eadp c\u1ee7a ng\u01b0\u1eddi d\u00f9ng v\u00e0 ch\u1ea1y l\u1ec7nh v\u1edbi t\u01b0 c\u00e1ch l\u00e0 m\u1ed9t ng\u01b0\u1eddi d\u00f9ng c\u1ee5 th\u1ec3.<\/span><\/p>\n<p style=\"padding-left: 40px;\"><span style=\"font-size: 16px;\">T\u00ecm hi\u1ec3u th\u00eam:\u00a0<a href=\"https:\/\/hocvienit.vn\/lenh-cmdlet-trong-powershell\/\" target=\"_blank\" rel=\"noopener\">M\u1ecdi \u0111i\u1ec1u b\u1ea1n c\u1ea7n bi\u1ebft v\u1ec1 l\u1ec7nh Cmdlet trong PowerShell<\/a><\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">M\u00f4-\u0111un trong PowerShell<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Nh\u1eb1m gi\u00fap gi\u1ea3m thi\u1ec3u s\u1ed1 l\u1ea7n, th\u1eddi gian nh\u1ea5n ph\u00edm c\u0169ng nh\u01b0 r\u00fat ng\u1eafn \u0111\u1ed9 d\u00e0i c\u1ee7a c\u1ea3 c\u00e2u l\u1ec7nh, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng alias (b\u00ed danh). M\u1eb7c d\u00f9 alias th\u01b0\u1eddng kh\u00f4ng \u0111\u01b0\u1ee3c \u0111\u1eb7t t\u00ean theo m\u1ed9t quy \u01b0\u1edbc nh\u1ea5t \u0111\u1ecbnh nh\u01b0ng ch\u00fang c\u0169ng ph\u1ea3n \u00e1nh \u0111\u01b0\u1ee3c ph\u1ea7n n\u00e0o c\u00e1c ti\u1ec7n \u00edch c\u1ee7a d\u00f2ng l\u1ec7nh truy\u1ec1n th\u1ed1ng. V\u00ed d\u1ee5, alias nh\u01b0 DIR l\u00e0 cmdlet Get-ChildItem.<\/span><\/p>\n<h2 style=\"text-align: justify;\"><span style=\"font-size: 24px;\"><strong>10 l\u1ec7nh c\u01a1 b\u1ea3n trong PowerShell<\/strong><\/span><\/h2>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Get-Help<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">\u0110\u00e2y l\u00e0 l\u1ec7nh \u0111\u1ea7u ti\u00ean v\u00e0 c\u0169ng l\u00e0 l\u1ec7nh quan tr\u1ecdng nh\u1ea5t. B\u1edfi n\u1ebfu b\u1ea1n ch\u01b0a bi\u1ebft c\u00e1ch s\u1eed d\u1ee5ng PowerShell th\u00ec khi x\u1ea3y ra v\u1ea5n \u0111\u1ec1, Get-Help ch\u00ednh l\u00e0 v\u1ecb c\u1ee9u tinh c\u1ee7a b\u1ea1n.\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">D\u00f2ng l\u1ec7nh n\u00e0y cung c\u1ea5p nh\u1eefng th\u00f4ng tin c\u1ea7n thi\u1ebft v\u1ec1 l\u1ec7nh gh\u00e9p ng\u1eafn, l\u1ec7nh, h\u00e0m, t\u1eadp l\u1ec7nh v\u00e0 lu\u1ed3ng c\u00f4ng vi\u1ec7c c\u1ee7a PowerShell.<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 16px;\"><strong>Get-Help Name<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Trong \u0111\u00f3: <strong>Name<\/strong> l\u00e0 t\u00ean c\u1ee7a l\u1ec7nh b\u1ea1n mu\u1ed1n ki\u1ec3m tra trong PowerShell.<\/span><\/p>\n<figure id=\"attachment_19490\" aria-describedby=\"caption-attachment-19490\" style=\"width: 750px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-19490 size-full\" title=\"Get-Help trong PowerShell\" src=\"https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/get-help-trong-powershell.jpg\" alt=\"Get-Help trong PowerShell\" width=\"750\" height=\"554\" srcset=\"https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/get-help-trong-powershell.jpg 750w, https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/get-help-trong-powershell-510x377.jpg 510w, https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/get-help-trong-powershell-300x222.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><figcaption id=\"caption-attachment-19490\" class=\"wp-caption-text\"><span style=\"font-size: 16px; color: #333333;\">Get-Help trong PowerShell<\/span><\/figcaption><\/figure>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Get-Command<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Get-Command l\u00e0 m\u1ed9t l\u1ec7nh gi\u00fap b\u1ea1n c\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u \u0111\u01b0\u1ee3c c\u00e1c l\u1ec7nh v\u00e0 nh\u1eefng t\u00ednh n\u0103ng c\u1ee7a l\u1ec7nh \u0111\u00f3 trong PowerShell. Trong \u0111\u00f3, \u0111\u1ec3 kh\u00e1m ph\u00e1 to\u00e0n b\u1ed9 PowerShell, b\u1ea1n ch\u1ec9 c\u1ea7n nh\u1eadp:\u00a0<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 16px;\"><strong>Get-Command<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">C\u00f2n n\u1ebfu b\u1ea1n mu\u1ed1n t\u00ecm ki\u1ebfm m\u1ed9t d\u1ea1ng l\u1ec7nh c\u1ee5 th\u1ec3 th\u00ec b\u1ea1n nh\u1eadp:\u00a0<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 16px;\"><strong>Get-Command *CommandFormat*<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Trong \u0111\u00f3: <strong>CommandFormat<\/strong> l\u00e0 d\u1ea1ng l\u1ec7nh b\u1ea1n mu\u1ed1n t\u00ecm ki\u1ebfm.<\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Invoke-Command<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Invoke-Command l\u00e0 l\u1ec7nh gi\u00fap b\u1ea1n c\u00f3 th\u1ec3 \u0111i\u1ec1u khi\u1ec3n h\u00e0ng lo\u1ea1t m\u00e1y t\u00ednh.\u00a0<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 16px;\"><strong>Invoke-Command L\u1ec7nh<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Trong \u0111\u00f3: <strong>L\u1ec7nh<\/strong> ch\u00ednh l\u00e0 l\u1ec7nh b\u1ea1n mu\u1ed1n \u0111i\u1ec1u khi\u1ec3n v\u1edbi \u0111\u01b0\u1eddng d\u1eabn \u0111\u1ea7y \u0111\u1ee7 c\u1ee7a n\u00f3.<\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Invoke-Expression<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">\u0110\u00e2y l\u00e0 l\u1ec7nh gi\u00fap b\u1ea1n \u0111\u00e1nh gi\u00e1 m\u1ed9t bi\u1ec3u th\u1ee9c ho\u1eb7c m\u1ed9t chu\u1ed7i \u0111\u1ea7u v\u00e0o r\u1ed3i m\u1edbi ch\u1ea1y l\u1ec7nh \u0111\u00f3. L\u1ec7nh Invoke-Expression ch\u1ec9 ho\u1ea1t \u0111\u1ed9ng c\u1ee5c b\u1ed9.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">V\u00ed d\u1ee5: Khi b\u1ea1n nh\u1eadp l\u1ec7nh \u201cInvoke-Expression $ Command\u201d c\u00f3 \u201c$ Command\u201d \u0111\u01b0\u1ee3c g\u00e1n v\u1edbi m\u1ed9t chu\u1ed7i n\u00f3i l\u1ec7nh \u201cGet-Process\u201d th\u00ec k\u1ebft qu\u1ea3 l\u00e0 \u201cGet-Process\u201d \u0111\u01b0\u1ee3c ch\u1ea1y nh\u01b0 m\u1ed9t l\u1ec7nh tr\u00ean m\u00e1y t\u00ednh c\u1ee5c b\u1ed9 c\u1ee7a b\u1ea1n.<\/span><\/p>\n<figure id=\"attachment_19491\" aria-describedby=\"caption-attachment-19491\" style=\"width: 750px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-19491 size-full\" title=\"L\u1ec7nh Invoke-Expression trong PowerShell\" src=\"https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/lenh-invoke-expression-trong-powershell.jpg\" alt=\"L\u1ec7nh Invoke-Expression trong PowerShell\" width=\"750\" height=\"544\" srcset=\"https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/lenh-invoke-expression-trong-powershell.jpg 750w, https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/lenh-invoke-expression-trong-powershell-510x370.jpg 510w, https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/lenh-invoke-expression-trong-powershell-300x218.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><figcaption id=\"caption-attachment-19491\" class=\"wp-caption-text\"><span style=\"font-size: 16px; color: #333333;\">L\u1ec7nh Invoke-Expression trong PowerShell<\/span><\/figcaption><\/figure>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Invoke-WebRequest<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">L\u1ec7nh Invoke-WebRequest gi\u00fap b\u1ea1n t\u1ea3i xu\u1ed1ng, \u0111\u0103ng nh\u1eadp v\u00e0 x\u00f3a th\u00f4ng tin tr\u00ean c\u00e1c trang web trong qu\u00e1 tr\u00ecnh l\u00e0m vi\u1ec7c v\u1edbi PowerShell. C\u00e1ch th\u1ef1c hi\u1ec7n l\u1ec7nh nh\u01b0 sau:<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 16px;\"><strong>(Invoke-WebRequest -Uri \u201c\u0110\u01b0\u1eddng d\u1eabn trang web\u201d).Links.Href<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Trong \u0111\u00f3: <strong>\u0110\u01b0\u1eddng d\u1eabn trang web<\/strong> ch\u00ednh l\u00e0 link c\u1ee7a trang web.<\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Get-ExecutionPolicy<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Get-ExecutionPolicy l\u00e0 l\u1ec7nh gi\u00fap b\u1ea1n c\u00f3 th\u1ec3 bi\u1ebft m\u1ee9c ch\u00ednh s\u00e1ch b\u1ea3o m\u1eadt \u0111ang \u0111\u01b0\u1ee3c \u00e1p d\u1ee5ng tr\u00ean PowerShell. \u0110\u1ec3 th\u1ef1c hi\u1ec7n l\u1ec7nh n\u00e0y, b\u1ea1n ch\u1ec9 c\u1ea7n nh\u1eadp:<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 16px;\"><strong>Get-ExecutionPolicy<\/strong><\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Set-ExecutionPolicy<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">\u0110\u1ec3 thi\u1ebft l\u1eadp m\u1ee9c b\u1ea3o m\u1eadt tr\u00ean PowerShell, b\u1ea1n c\u1ea7n s\u1eed d\u1ee5ng l\u1ec7nh Set-ExecutionPolicy. C\u00f3 4 l\u1ef1a ch\u1ecdn m\u1ee9c \u0111\u1ed9 b\u1ea3o m\u1eadt nh\u01b0 sau:<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; <strong>Restricted:<\/strong> \u0110\u00e2y l\u00e0 m\u1ee9c \u0111\u1ed9 b\u1ea3o m\u1eadt m\u1eb7c \u0111\u1ecbnh c\u1ee7a h\u1ec7 th\u1ed1ng. T\u1ea5t c\u1ea3 c\u00e1c l\u1ec7nh \u0111\u00e3 b\u1ecb kh\u00f3a v\u00e0 b\u1ea1n ch\u1ec9 c\u00f3 th\u1ec3 nh\u1eadp l\u1ec7nh nh\u01b0ng kh\u00f4ng th\u1ec3 th\u1ef1c hi\u1ec7n.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; <strong>All Signed:<\/strong> \u1ede m\u1ee9c \u0111\u1ed9 b\u1ea3o m\u1eadt n\u00e0y, b\u1ea1n ch\u1ec9 c\u00f3 th\u1ec3 th\u1ef1c thi c\u00e1c l\u1ec7nh \u0111\u01b0\u1ee3c ch\u1ec9 \u0111\u1ecbnh.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; <strong>Remote Signed:<\/strong> \u0110\u00e2y l\u00e0 m\u1ee9c \u0111\u1ed9 b\u1ea3o m\u1eadt ch\u1ec9 cho ph\u00e9p nh\u1eefng \u0111o\u1ea1n m\u00e3 PowerShell \u0111\u01b0\u1ee3c t\u1ea1o b\u00ean trong h\u1ec7 th\u1ed1ng local ho\u1ea1t \u0111\u1ed9ng. C\u00f2n nh\u1eefng m\u00e3 \u0111\u01b0\u1ee3c t\u1ea1o th\u00f4ng qua remote ho\u1ea1t \u0111\u1ed9ng khi c\u00f3 \u0111\u1ea7y \u0111\u1ee7 thu\u1ed9c t\u00ednh.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">&#8211; <strong>Unrestricted:<\/strong> M\u1ee9c \u0111\u1ed9 b\u1ea3o m\u1eadt n\u00e0y kh\u00f4ng h\u1ec1 ng\u0103n c\u1ea5m b\u1ea5t c\u1ee9 h\u00ecnh th\u1ee9c n\u00e0o trong h\u1ec7 th\u1ed1ng.<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">\u0110\u1ec3 s\u1eed d\u1ee5ng l\u1ec7nh n\u00e0y, b\u1ea1n nh\u1eadp:<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 16px;\"><strong>Set-ExecutionPolicy M\u1ee9c \u0111\u1ed9 b\u1ea3o m\u1eadt<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Trong \u0111\u00f3: <strong>M\u1ee9c \u0111\u1ed9 b\u1ea3o m\u1eadt<\/strong> ch\u00ednh l\u00e0 m\u1ed9t trong b\u1ed1n m\u1ee9c \u0111\u1ed9 b\u1ea3o m\u1eadt k\u1ec3 tr\u00ean m\u00e0 b\u1ea1n mu\u1ed1n \u00e1p d\u1ee5ng.<\/span><\/p>\n<figure id=\"attachment_19492\" aria-describedby=\"caption-attachment-19492\" style=\"width: 750px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-19492 size-full\" title=\"L\u1ec7nh Set-ExecutionPolicy trong PowerShell\" src=\"https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/lenh-set-executionpolicy-trong-powershell.jpg\" alt=\"L\u1ec7nh Set-ExecutionPolicy trong PowerShell\" width=\"750\" height=\"182\" srcset=\"https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/lenh-set-executionpolicy-trong-powershell.jpg 750w, https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/lenh-set-executionpolicy-trong-powershell-510x124.jpg 510w, https:\/\/hocvienit.vn\/wp-content\/uploads\/2021\/01\/lenh-set-executionpolicy-trong-powershell-300x73.jpg 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><figcaption id=\"caption-attachment-19492\" class=\"wp-caption-text\"><span style=\"font-size: 16px; color: #333333;\">L\u1ec7nh Set-ExecutionPolicy trong PowerShell<\/span><\/figcaption><\/figure>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Get-Item<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">B\u1ea1n \u0111ang t\u00ecm ki\u1ebfm th\u00f4ng tin v\u1ec1 m\u1ed9t th\u01b0 m\u1ee5c n\u00e0o \u0111\u00f3 \u01b0? V\u1eady l\u1ec7nh Get-Item ch\u00ednh l\u00e0 c\u00e1ch nhanh nh\u1ea5t gi\u00fap b\u1ea1n t\u00ecm th\u1ea5y n\u00f3. B\u1ea1n nh\u1eadp nh\u01b0 sau:<\/span><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 16px;\"><strong>Get-Item \u0110\u01b0\u1eddng d\u1eabn ho\u1eb7c m\u1ed9t chu\u1ed7i tham s\u1ed1<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">V\u00ed d\u1ee5: B\u1ea1n mu\u1ed1n hi\u1ec3n th\u1ecb th\u00f4ng tin c\u1ee7a t\u1ea5t c\u1ea3 th\u01b0 m\u1ee5c b\u1eaft \u0111\u1ea7u b\u1eb1ng ch\u1eef c\u00e1i \u201cT\u201d trong th\u01b0 m\u1ee5c hi\u1ec7n t\u1ea1i th\u00ec b\u1ea1n nh\u1eadp \u201cGet-Item T*\u201d.<\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Copy-Item\u00a0<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">L\u1ec7nh Copy-Item t\u01b0\u01a1ng t\u1ef1 nh\u01b0 l\u1ec7nh \u201ccp\u201d trong Command Prompt (CMD) nh\u01b0ng n\u00f3 t\u1ed1t h\u01a1n. N\u00f3 c\u00f3 kh\u1ea3 n\u0103ng sao ch\u00e9p c\u00e1c t\u1ec7p v\u00e0 th\u01b0 m\u1ee5c tr\u00ean \u1ed5 c\u1ee9ng ho\u1eb7c c\u00e1c m\u1ee5c \u0111\u0103ng k\u00fd (Registry) v\u00e0 kh\u00f3a (Key) trong Windows Registry.<\/span><\/p>\n<h3 style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 20px;\">Remove-Item<\/span><\/h3>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">N\u1ebfu mu\u1ed1n x\u00f3a c\u00e1c t\u1ec7p v\u00e0 th\u01b0 m\u1ee5c tr\u00ean \u1ed5 c\u1ee9ng ho\u1eb7c c\u00e1c bi\u1ebfn \u0111\u0103ng k\u00fd (Registry) v\u00e0 kh\u00f3a (Key) trong <strong><a href=\"https:\/\/hocvienit.vn\/tat-tan-tat-ve-windows-registry\/\" target=\"_blank\" rel=\"noopener\">Windows Registry<\/a><\/strong> th\u00ec b\u1ea1n h\u00e3y s\u1eed d\u1ee5ng Remove-Item.\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400; font-size: 16px;\">Tr\u00ean \u0111\u00e2y l\u00e0 chia s\u1ebb c\u1ee7a H\u1ecdc vi\u1ec7n iT.vn v\u1ec1 PowerShell. Hy v\u1ecdng nh\u1eefng ki\u1ebfn th\u1ee9c n\u00e0y c\u00f3 th\u1ec3 gi\u00fap \u00edch cho b\u1ea1n trong qu\u00e1 tr\u00ecnh h\u1ecdc t\u1eadp v\u00e0 l\u00e0m vi\u1ec7c. N\u1ebfu c\u00f3 b\u1ea5t c\u1ee9 th\u1eafc m\u1eafc n\u00e0o th\u00ec h\u00e3y \u0111\u1ec3 l\u1ea1i b\u00ecnh lu\u1eadn ngay d\u01b0\u1edbi b\u00e0i vi\u1ebft n\u00e0y ho\u1eb7c inbox tr\u1ef1c ti\u1ebfp cho HOCVIENiT.vn \u0111\u1ec3 \u0111\u01b0\u1ee3c gi\u1ea3i \u0111\u00e1p t\u1ed1t nh\u1ea5t. Ch\u00fac b\u1ea1n th\u00e0nh c\u00f4ng!<\/span><\/p>\n<p style=\"text-align: left;\"><i>M\u1ecdi chi ti\u1ebft xin vui l\u00f2ng li\u00ean h\u1ec7:<br \/>\n<\/i><strong>C\u00d4NG TY C\u1ed4 PH\u1ea6N H\u1eccC VI\u1ec6N IT<br \/>\n<\/strong><strong>MST: 0108733789<br \/>\n<\/strong><strong>Hotline: 0981 223 001<br \/>\n<\/strong><strong>Facebook:<\/strong>\u00a0<a href=\"http:\/\/www.fb.com\/hocvienit\" target=\"_blank\" rel=\"noopener\">www.fb.com\/hocvienit<\/a><br \/>\n<strong>\u0110\u0103ng k\u00fd k\u00eanh Youtube \u0111\u1ec3 theo d\u00f5i c\u00e1c b\u00e0i h\u1ecdc c\u1ee7a Hu\u1ea5n luy\u1ec7n vi\u00ean t\u1ed1t nh\u1ea5t:<\/strong>\u00a0<a href=\"http:\/\/bit.ly\/Youtube_HOCVIENiT\" target=\"_blank\" rel=\"noopener nofollow\">http:\/\/bit.ly\/Youtube_HOCVIENiT<\/a><br \/>\n<b>H\u1ec7 th\u1ed1ng c\u01a1 s\u1edf \u0111\u00e0o t\u1ea1o:\u00a0<\/b><a href=\"https:\/\/hocvienit.vn\/lien-he\/\" target=\"_blank\" rel=\"noopener\">https:\/\/hocvienit.vn\/lien-he\/<\/a><br \/>\n<strong><i>H\u1ecdc vi\u1ec7n IT.vn \u2013 Truy\u1ec1n ngh\u1ec1 th\u1ef1c t\u1ebf c\u00f9ng b\u1ea1n \u0111\u1ebfn th\u00e0nh c\u00f4ng!\u00a0<\/i><\/strong><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows PowerShell l\u00e0 m\u1ed9t ti\u1ec7n \u00edch m\u1edbi c\u1ee7a Microsoft nh\u1eb1m thay th\u1ebf cho Command Prompt trong t\u01b0\u01a1ng lai. Th\u1ebf nh\u01b0ng b\u1ea1n c\u00f3 bi\u1ebft PowerShell l\u00e0 g\u00ec v\u00e0 nh\u1eefng ki\u1ebfn th\u1ee9c c\u01a1 b\u1ea3n v\u1ec1 PowerShell hay ch\u01b0a? H\u00e3y c\u00f9ng t\u00ecm hi\u1ec3u chi ti\u1ebft trong b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y nh\u00e9.<\/p>\n","protected":false},"author":95,"featured_media":19489,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[96,94],"tags":[577],"_links":{"self":[{"href":"https:\/\/hocvienit.vn\/index.php?rest_route=\/wp\/v2\/posts\/19488"}],"collection":[{"href":"https:\/\/hocvienit.vn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hocvienit.vn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hocvienit.vn\/index.php?rest_route=\/wp\/v2\/users\/95"}],"replies":[{"embeddable":true,"href":"https:\/\/hocvienit.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19488"}],"version-history":[{"count":0,"href":"https:\/\/hocvienit.vn\/index.php?rest_route=\/wp\/v2\/posts\/19488\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hocvienit.vn\/index.php?rest_route=\/wp\/v2\/media\/19489"}],"wp:attachment":[{"href":"https:\/\/hocvienit.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hocvienit.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hocvienit.vn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}