<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Command Prompt &#8211; Nhật Phúc</title>
	<atom:link href="https://nhatphuc.com/bai-viet/command-prompt/feed/" rel="self" type="application/rss+xml" />
	<link>https://nhatphuc.com</link>
	<description></description>
	<lastBuildDate>Thu, 26 Sep 2024 02:21:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://nhatphuc.com/wp-content/uploads/2019/08/favicon-75x75.png</url>
	<title>Command Prompt &#8211; Nhật Phúc</title>
	<link>https://nhatphuc.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Cách kiểm tra phiên bản PowerShell đã cài đặt</title>
		<link>https://nhatphuc.com/cach-kiem-tra-phien-ban-powershell-da-cai-dat/</link>
					<comments>https://nhatphuc.com/cach-kiem-tra-phien-ban-powershell-da-cai-dat/#respond</comments>
		
		<dc:creator><![CDATA[Linh Nguyễn]]></dc:creator>
		<pubDate>Thu, 26 Sep 2024 02:21:42 +0000</pubDate>
				<category><![CDATA[Phần mềm hay]]></category>
		<category><![CDATA[Khám phá]]></category>
		<category><![CDATA[Command Prompt]]></category>
		<category><![CDATA[PowerShell]]></category>
		<guid isPermaLink="false">https://nhatphuc.com/?p=12394</guid>

					<description><![CDATA[<p>PowerShell là một công cụ dòng lệnh mạnh mẽ được phát triển bởi Microsoft, giúp [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://nhatphuc.com/cach-kiem-tra-phien-ban-powershell-da-cai-dat/">Cách kiểm tra phiên bản PowerShell đã cài đặt</a> appeared first on <a rel="nofollow" href="https://nhatphuc.com">Nhật Phúc</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>PowerShell là một công cụ dòng lệnh mạnh mẽ được phát triển bởi Microsoft, giúp quản lý hệ thống và tự động hóa các tác vụ. Để biết chính xác phiên bản PowerShell đang được cài đặt trên hệ thống của bạn, bạn có thể sử dụng một số lệnh đơn giản. Hướng dẫn này giúp bạn biết cách kiểm tra phiên bản PowerShell trên máy tính.</p>



<h2 class="wp-block-heading">Kiểm tra phiên bản PowerShell từ PowerShell</h2>



<p>Bạn có thể sử dụng lệnh sau để kiểm tra phiên bản PowerShell đang chạy:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">$PSVersionTable.PSVersion</pre>



<p>Lệnh này sẽ hiển thị thông tin về phiên bản của PowerShell, bao gồm:</p>



<ul class="wp-block-list">
<li><strong>Major</strong>: Phiên bản chính.</li>



<li><strong>Minor</strong>: Phiên bản phụ.</li>



<li><strong>Build</strong>: Số build.</li>



<li><strong>Revision</strong>: Số sửa đổi.</li>
</ul>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="436" height="145" src="https://nhatphuc.com/wp-content/uploads/2024/09/powershell-version.png" alt="Cách kiểm tra phiên bản PowerShell đã cài đặt 1" class="wp-image-12395" title="Cách kiểm tra phiên bản PowerShell đã cài đặt 1" srcset="https://nhatphuc.com/wp-content/uploads/2024/09/powershell-version.png 436w, https://nhatphuc.com/wp-content/uploads/2024/09/powershell-version-320x106.png 320w, https://nhatphuc.com/wp-content/uploads/2024/09/powershell-version-265x88.png 265w, https://nhatphuc.com/wp-content/uploads/2024/09/powershell-version-364x121.png 364w, https://nhatphuc.com/wp-content/uploads/2024/09/powershell-version-144x48.png 144w, https://nhatphuc.com/wp-content/uploads/2024/09/powershell-version-289x96.png 289w" sizes="(max-width: 436px) 100vw, 436px" /></figure>



<p><code><br></code></p>



<h2 class="wp-block-heading">Kiểm tra phiên bản PowerShell từ Command Prompt</h2>



<p>Nếu bạn muốn kiểm tra phiên bản PowerShell từ Command Prompt mà không cần mở PowerShell, bạn có thể chạy lệnh sau:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">powershell -Command "$PSVersionTable.PSVersion"</pre>



<p>Lệnh này sẽ mở PowerShell, thực thi câu lệnh <code>$PSVersionTable.PSVersion</code> và trả về kết quả trực tiếp trên cửa sổ Command Prompt.</p>



<h2 class="wp-block-heading">Khi PowerShell không được cài đặt</h2>



<p>Nếu lệnh trên không hoạt động hoặc không có biến <code>$PSVersionTable</code>, điều này có nghĩa là phiên bản PowerShell của bạn có thể là phiên bản 1.0, phiên bản cũ nhất không hỗ trợ biến này. Khi đó, bạn nên kiểm tra xem PowerShell có được cài đặt hay không.</p>



<p>Bạn có thể kiểm tra qua Registry bằng cách vào đường dẫn sau:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell\1\Install</pre>



<p>Nếu giá trị là <code>1</code>, PowerShell đã được cài đặt.</p>



<p>Việc biết rõ phiên bản PowerShell sẽ giúp bạn biết được các tính năng mà phiên bản của bạn hỗ trợ, đồng thời giúp bạn cập nhật lên phiên bản mới nhất khi cần thiết.</p>
<p>The post <a rel="nofollow" href="https://nhatphuc.com/cach-kiem-tra-phien-ban-powershell-da-cai-dat/">Cách kiểm tra phiên bản PowerShell đã cài đặt</a> appeared first on <a rel="nofollow" href="https://nhatphuc.com">Nhật Phúc</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nhatphuc.com/cach-kiem-tra-phien-ban-powershell-da-cai-dat/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sửa lỗi: &#8220;Execution of scripts is disabled on this system&#8221; trong PowerShell</title>
		<link>https://nhatphuc.com/sua-loi-execution-of-scripts-is-disabled-on-this-system-trong-powershell/</link>
					<comments>https://nhatphuc.com/sua-loi-execution-of-scripts-is-disabled-on-this-system-trong-powershell/#respond</comments>
		
		<dc:creator><![CDATA[Linh Nguyễn]]></dc:creator>
		<pubDate>Wed, 25 Sep 2024 08:26:27 +0000</pubDate>
				<category><![CDATA[Phần mềm hay]]></category>
		<category><![CDATA[Khám phá]]></category>
		<category><![CDATA[Command Prompt]]></category>
		<category><![CDATA[PowerShell]]></category>
		<guid isPermaLink="false">https://nhatphuc.com/?p=12372</guid>

					<description><![CDATA[<p>Khi bạn cố gắng chạy một script PowerShell trên hệ thống và gặp thông báo [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://nhatphuc.com/sua-loi-execution-of-scripts-is-disabled-on-this-system-trong-powershell/">Sửa lỗi: &#8220;Execution of scripts is disabled on this system&#8221; trong PowerShell</a> appeared first on <a rel="nofollow" href="https://nhatphuc.com">Nhật Phúc</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Khi bạn cố gắng chạy một script PowerShell trên hệ thống và gặp thông báo lỗi: &#8220;Execution of scripts is disabled on this system,&#8221; điều này thường liên quan đến chính sách thực thi (Execution Policy) của PowerShell. Dưới đây là một số phương pháp để khắc phục lỗi này.</p>



<h2 class="wp-block-heading">1. Hiểu về PowerShell Execution Policy</h2>



<p>PowerShell có các mức chính sách thực thi để bảo vệ hệ thống khỏi việc chạy các script không đáng tin cậy. Các mức chính sách phổ biến bao gồm:</p>



<ul class="wp-block-list">
<li><strong>Restricted</strong>: Chặn hoàn toàn việc chạy script.</li>



<li><strong>AllSigned</strong>: Yêu cầu tất cả các script phải được ký số bởi nhà phát triển đáng tin cậy.</li>



<li><strong>RemoteSigned</strong>: Cho phép chạy các script cục bộ không cần ký, nhưng các script tải từ Internet phải được ký.</li>



<li><strong>Unrestricted</strong>: Không yêu cầu chữ ký và có thể chạy bất kỳ script nào, nhưng sẽ có cảnh báo khi chạy script từ Internet.</li>
</ul>



<h2 class="wp-block-heading">2. Cách kiểm tra chính sách thực thi hiện tại</h2>



<p>Sử dụng lệnh sau để kiểm tra chính sách thực thi hiện tại của bạn:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">Get-ExecutionPolicy</pre>



<h2 class="wp-block-heading">3. Thiết lập lại chính sách thực thi</h2>



<p>Nếu bạn cần thay đổi chính sách thực thi để có thể chạy các script, hãy chạy PowerShell với quyền Administrator và sử dụng một trong các lệnh sau:</p>



<ul class="wp-block-list">
<li>Đặt chính sách thành <strong>RemoteSigned</strong> (mức bảo mật hợp lý):<br><code><strong>Set-ExecutionPolicy RemoteSigned</strong></code></li>



<li>Đặt chính sách thành <strong>Unrestricted</strong> (cho phép chạy mọi script):<br><code><strong>Set-ExecutionPolicy Unrestricted</strong></code></li>



<li>Nếu bạn không có quyền quản trị, bạn có thể chỉ định chính sách cho người dùng hiện tại:<br><code><strong>Set-ExecutionPolicy RemoteSigned -Scope CurrentUser</strong></code></li>
</ul>



<h2 class="wp-block-heading">4. Bỏ qua chính sách thực thi cho một script cụ thể</h2>



<p>Nếu bạn không muốn thay đổi chính sách toàn hệ thống, bạn có thể bỏ qua chính sách thực thi chỉ cho một script bằng cách sử dụng lệnh sau:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">-ExecutionPolicy Bypass -File script.ps1</pre>



<p>Lệnh này sẽ bỏ qua chính sách thực thi hiện tại chỉ cho lần chạy này.</p>



<h2 class="wp-block-heading">5. Sử dụng Group Policy Editor (gpedit.msc)</h2>



<p>Nếu bạn không thể thay đổi chính sách bằng các lệnh PowerShell, hãy sử dụng <strong>Group Policy Editor</strong> để cho phép chạy script:</p>



<ol class="wp-block-list">
<li>Nhấn <strong>Windows + R</strong>, nhập <code>gpedit.msc</code> và nhấn <strong>Enter</strong>.</li>



<li>Điều hướng đến: <strong>Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Windows PowerShell</strong>.</li>



<li>Kích hoạt <strong>Turn on Script Execution</strong> và chọn <strong>Allow all scripts</strong>.</li>
</ol>



<p>Lưu ý: Khi bạn dùng các chính sách như <strong>Unrestricted</strong> có thể làm giảm bảo mật hệ thống, đặc biệt là khi chạy các script từ nguồn không đáng tin cậy. Bạn nên sử dụng mức <strong>RemoteSigned</strong> khi có thể, và luôn kiểm tra nguồn gốc của các script trước khi chạy.</p>
<p>The post <a rel="nofollow" href="https://nhatphuc.com/sua-loi-execution-of-scripts-is-disabled-on-this-system-trong-powershell/">Sửa lỗi: &#8220;Execution of scripts is disabled on this system&#8221; trong PowerShell</a> appeared first on <a rel="nofollow" href="https://nhatphuc.com">Nhật Phúc</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nhatphuc.com/sua-loi-execution-of-scripts-is-disabled-on-this-system-trong-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
