<?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>Automation - TheCodeBuzz</title>
	<atom:link href="https://thecodebuzz.com/category/automation/feed/" rel="self" type="application/rss+xml" />
	<link>https://thecodebuzz.com</link>
	<description>Best Practices for Software Development</description>
	<lastBuildDate>Mon, 23 Nov 2026 17:53:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://thecodebuzz.com/wp-content/uploads/2022/11/cropped-android-chrome-512x512-1-1-51x51.jpg</url>
	<title>Automation - TheCodeBuzz</title>
	<link>https://thecodebuzz.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Remove a URL from Google Search: Removals, noindex, 404</title>
		<link>https://thecodebuzz.com/how-to-remove-website-urls-google-search-indexing-or-crawling-api/</link>
					<comments>https://thecodebuzz.com/how-to-remove-website-urls-google-search-indexing-or-crawling-api/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 02 Dec 2023 02:29:00 +0000</pubDate>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[remove-website-urls-google-search]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=29200</guid>

					<description><![CDATA[<p>Remove a URL from Google Search with the Removals tool, 404/410, noindex or a password. Covers robots.txt limits, outdated content and other sites.</p>
<p>The post <a href="https://thecodebuzz.com/how-to-remove-website-urls-google-search-indexing-or-crawling-api/">Remove a URL from Google Search: Removals, noindex, 404</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">A page you never meant to show, an old staging URL or a product that no longer exists is still appearing when you search Google. You want it gone, and the quickest-looking fix, blocking it in <code>robots.txt</code>, is the one that usually does not work. Which method to use depends on what you want to happen to the page.</p>



<p class="wp-block-paragraph">To <strong>remove a URL from Google Search</strong> you own, use the Removals tool in Search Console for a fast but temporary hide (about six months), then make it permanent by returning 404 or 410, password-protecting the page, or adding a <code>noindex</code> rule. For pages on other people&#8217;s sites, Google has separate request forms. This guide follows Google&#8217;s current documentation and links to it at each step.</p>



<figure class="wp-block-image size-large"><img decoding="async" src="https://thecodebuzz.com/wp-content/uploads/2026/11/removeurl-decision-flowchart.png" alt="Decision flowchart for removing a URL from Google Search: Removals tool for urgent hiding, then 404 or 410, password protection or noindex"/><figcaption class="wp-element-caption">Pick the path first, then follow the matching section below.</figcaption></figure>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-few-common-reasons-for-removing-the-urls-are-as-below">Which method fits your situation?</a></li><li><a href="#aioseo-remove-url-from-indexing-immediately-steps-by-step">Temporary removal with the Removals tool</a></li><li><a href="#aioseo-make-url-removal-permanent">Make the removal permanent</a></li><li><a href="#robots">Why robots.txt Disallow alone does not remove a page</a></li><li><a href="#images">Removing images</a></li><li><a href="#outdated">Outdated content on a page you do not own</a></li><li><a href="#personal">Personal information on someone else&#8217;s site</a></li><li><a href="#aioseo-remove-url-permanently-using-google-indexing-api">What about the Indexing API?</a></li><li><a href="#how-long">How long does removal take?</a></li><li><a href="#verify">How to verify the page is gone</a></li><li><a href="#faq">Frequently asked questions</a></li><li><a href="#summary">Summary</a></li></ul></div>



<h2 class="wp-block-heading" id="aioseo-few-common-reasons-for-removing-the-urls-are-as-below">Which method fits your situation?</h2>



<p class="wp-block-paragraph">Start with two questions: do you own the site in Search Console, and what should happen to the page afterwards?</p>



<ul class="wp-block-list">
<li><strong>Page is on your site and must disappear fast:</strong> use the Removals tool (next section), then a permanent fix.</li>

<li><strong>Page should be deleted:</strong> return <code>404</code> or <code>410</code>.</li>

<li><strong>Page should stay for some people only:</strong> put it behind a password.</li>

<li><strong>Page should stay public but out of Google:</strong> use <code>noindex</code> (meta tag or <code>X-Robots-Tag</code> header).</li>

<li><strong>Page is on someone else&#8217;s site:</strong> see the outdated content and personal information sections.</li>
</ul>



<p class="wp-block-paragraph">Common reasons people do this include private or internal pages, outdated or thin content, and temporary or staging pages that were indexed by mistake.</p>



<h2 class="wp-block-heading" id="aioseo-remove-url-from-indexing-immediately-steps-by-step">Temporary removal with the Removals tool</h2>



<p class="wp-block-paragraph">The Removals tool hides a URL from Google Search results quickly. Per Google, the request usually takes up to a day to process and is not guaranteed to be accepted. A successful request lasts only about six months, and blocking a URL does not stop Google from crawling it. The URL must be in a Search Console property that you own. Details are in the <a href="https://support.google.com/webmasters/answer/9689846" target="_blank" rel="noopener">Removals tool help</a>.</p>



<ol class="wp-block-list">
<li>Open the <a href="https://search.google.com/search-console/removals" target="_blank" rel="noopener">Removals tool</a> in Search Console and pick your property.</li>

<li>Select the <strong>Temporary Removals</strong> tab and click <strong>New Request</strong>.</li>

<li>Choose <strong>Temporarily remove URL</strong> (hides it for about six months and clears the snippet) or <strong>Clear snippet in search</strong> (only wipes the description until the page is reindexed).</li>

<li>Enter the exact URL. Pick <strong>Remove this URL only</strong>, or <strong>Remove all URLs with this prefix</strong> to cover a whole folder. Omit anchors (<code>#section</code>) and optional parameters.</li>

<li>Click <strong>Next</strong> and check the request status later. If it is denied, use <strong>Learn more</strong> to see why.</li>
</ol>



<p class="wp-block-paragraph">Two details trip people up. First, the exact URL matters: <code>/Dragon</code> and <code>/dragon</code> are different URLs, and the same content can be reachable under several URLs, so submit one request for each variation that shows in results. Second, the http/https and www/non-www versions of a URL are matched together, but other subdomains such as <code>m.</code> are not.</p>



<p class="wp-block-paragraph">If the URL is unreachable when you submit (404, 502, 503), Google assumes the page is gone and the block request will expire. Any page found at that URL later is treated as a new page that can appear in results. You can cancel a request from the history table in the same tool.</p>



<h2 class="wp-block-heading" id="aioseo-make-url-removal-permanent">Make the removal permanent</h2>



<p class="wp-block-paragraph">The Removals tool is only the first step. For a lasting result, do one of the following, as described in Google&#8217;s documentation (<a href="https://developers.google.com/search/docs/crawling-indexing/remove-information" target="_blank" rel="noopener">Google Search Central: remove a page hosted on your site</a>):</p>



<h3 class="wp-block-heading">Option 1: Delete the page (404 or 410)</h3>



<p class="wp-block-paragraph">Remove the page, image or directory and make sure the server returns <code>404 (Not Found)</code> or <code>410 (Gone)</code>. Non-HTML files such as PDFs should be removed from the server completely. This is the most secure option because other search engines and visitors lose access too. Check the status code after deploying, for example with <code>curl -I https://example.com/old-page</code>.</p>



<h3 class="wp-block-heading">Option 2: Password-protect the page</h3>



<p class="wp-block-paragraph">Requiring a login lets the right people in while keeping Googlebot and other crawlers out.</p>



<h3 class="wp-block-heading">Option 3: Add noindex</h3>



<p class="wp-block-paragraph">Use this when the page must stay reachable but should not appear in Google. Place this in the page <code>&lt;head&gt;</code>:</p>



<pre class="wp-block-code"><code>&lt;meta name=&quot;robots&quot; content=&quot;noindex&quot;&gt;</code></pre>



<p class="wp-block-paragraph">To target only Google&#8217;s crawlers, use <code>name="googlebot"</code> instead. For PDFs, images and other non-HTML files, send an HTTP response header instead:</p>



<pre class="wp-block-code"><code>HTTP/1.1 200 OK
X-Robots-Tag: noindex</code></pre>



<p class="wp-block-paragraph">Google notes that <code>noindex</code> only blocks the page from Google results; users and search engines that do not support it can still open the page, so it is less secure than the other two. In a CMS such as WordPress, look for a per-page or site-wide search engine visibility setting instead of editing HTML. Googlebot has to crawl the page to see the rule, so it can take time to take effect (see below). Google documents this in <a href="https://developers.google.com/search/docs/crawling-indexing/block-indexing" target="_blank" rel="noopener">Block Search indexing with noindex</a>.</p>



<p class="wp-block-paragraph">If you used the Removals tool before applying the permanent fix, Google advises that you unblock and then reblock the page afterwards. This clears the page from the index if it was recrawled after blocking.</p>



<h2 class="wp-block-heading" id="robots">Why robots.txt Disallow alone does not remove a page</h2>



<p class="wp-block-paragraph">A <code>Disallow</code> rule in robots.txt stops Google from crawling a URL, not from indexing it. Google states that a page blocked by robots.txt can still appear in results if other pages link to it, just without a description. Worse, if you add <code>noindex</code> to a page that robots.txt also blocks, Googlebot never fetches the page, never sees the rule, and the URL can stay in results. Google&#8217;s own removal guide says not to use robots.txt as a blocking mechanism. See <a href="https://developers.google.com/search/docs/crawling-indexing/robots/intro" target="_blank" rel="noopener">Introduction to robots.txt</a>.</p>



<p class="wp-block-paragraph">The fix is the reverse of the instinct: remove the <code>Disallow</code> for that URL, let Googlebot crawl it, and let it find the 404/410 or <code>noindex</code>. Once the page has dropped out of results, you can decide whether to block crawling again.</p>



<h2 class="wp-block-heading" id="images">Removing images</h2>



<p class="wp-block-paragraph">For an image on your site, the same Removals tool handles the urgent case (find the image URL by copying the link address from the Google Images result, not by left-clicking it). Without a permanent fix the image can return when the request expires. For non-emergency removal, Google documents two routes: robots.txt disallow rules for the image file, or a <code>noindex</code> <code>X-Robots-Tag</code> header. Unlike pages, Google&#8217;s image documentation lists robots.txt as an accepted route for image files. Using both methods together makes no sense, because Googlebot has to crawl the image to see the header. If you cannot control headers (for example on a CDN), you may need to delete the image. See <a href="https://developers.google.com/search/docs/crawling-indexing/prevent-images-on-your-page" target="_blank" rel="noopener">Remove images hosted on your site</a>.</p>



<h2 class="wp-block-heading" id="outdated">Outdated content on a page you do not own</h2>



<p class="wp-block-paragraph">If a page on someone else&#8217;s site has changed or been deleted but Google still shows the old description or cache, use Google&#8217;s <a href="https://support.google.com/websearch/answer/6349986" target="_blank" rel="noopener">Refresh outdated content</a> tool. Select <strong>Request refresh</strong>, enter the URL of the page, and submit. The same page covers images. Google says you do not need the form if the live page has already been updated, because the result refreshes on recrawl. The tool does not remove content that still exists on the page; that has to be handled with the site owner.</p>



<p class="wp-block-paragraph">Site owners can see these requests in the <strong>Outdated content</strong> tab of the Removals tool.</p>



<h2 class="wp-block-heading" id="personal">Personal information on someone else&#8217;s site</h2>



<p class="wp-block-paragraph">If the content is about you, Google lets you or a representative ask for removal of certain personal information from Search results, such as government ID numbers, bank or credit card numbers, confidential passwords, private records like medical records, and some contact details. Doxxing content can also be reported. Start from <a href="https://support.google.com/websearch/answer/9673730" target="_blank" rel="noopener">Remove my private info from Google Search</a>. You must provide the URLs of the pages that contain the information, and Google may decline if the content is newsworthy or in the public interest.</p>



<p class="wp-block-paragraph">This only affects Google Search. The content stays on the host site and may still appear in other search engines, so contact the site owner as well.</p>



<h2 class="wp-block-heading" id="aioseo-remove-url-permanently-using-google-indexing-api">What about the Indexing API?</h2>



<p class="wp-block-paragraph">Older versions of this article suggested the Google Indexing API as a general way to remove URLs. That is not accurate. According to Google&#8217;s <a href="https://developers.google.com/search/apis/indexing-api/v3/quickstart" target="_blank" rel="noopener">Indexing API quickstart</a>, the API can only be used for pages with <code>JobPosting</code> structured data or <code>BroadcastEvent</code> embedded in a <code>VideoObject</code> (job postings and livestream videos). For those pages, a <code>URL_DELETED</code> notification tells Google that the page was removed from your server:</p>



<pre class="wp-block-code"><code>{
  &quot;url&quot;: &quot;https://example.com/jobs/senior-engineer&quot;,
  &quot;type&quot;: &quot;URL_DELETED&quot;
}</code></pre>



<p class="wp-block-paragraph">For an ordinary blog post, product page or document, use the methods above. The API requires a service account, an approved quota and compliance with Google&#8217;s guidelines, and abuse can lead to revoked access. The code in this section was not run against the live API, and bulk submission of normal URLs is covered separately in <a href="https://www.thecodebuzz.com/how-to-bulk-submit-website-urls-index-google-search-engine-console-wordpress-crawling/">how to bulk index URLs to Google</a> and <a href="https://www.thecodebuzz.com/python-script-bulk-submit-urls-to-google-search-console-indexing-crawling/">the Python script to submit URLs to Google</a>.</p>



<h2 class="wp-block-heading" id="how-long">How long does removal take?</h2>



<ul class="wp-block-list">
<li><strong>Removals tool:</strong> usually up to a day, not guaranteed.</li>

<li><strong>noindex or 404/410:</strong> only after Google recrawls the page. Google says that, depending on the importance of the page, this can take months. You can ask for a recrawl with the URL Inspection tool.</li>

<li><strong>Outdated content or personal info requests:</strong> reviewed by Google; Google emails the outcome for personal info requests.</li>
</ul>



<p class="wp-block-paragraph">Google also notes that old pages returning 404 will naturally drop out of results as they are recrawled, so there is no need to request urgent removal for routine cleanup. The Removals tool is not meant for crawl errors or duplicate-URL cleanup either; use canonical URLs for duplicates.</p>



<h2 class="wp-block-heading" id="verify">How to verify the page is gone</h2>



<ol class="wp-block-list">
<li>Open the <a href="https://support.google.com/webmasters/answer/9012289" target="_blank" rel="noopener">URL Inspection tool</a> for the URL. The indexed result shows how Google last saw the page, and a live test shows whether it is currently indexable. For <code>noindex</code>, it can show the HTML Googlebot received.</li>

<li>Check the <strong>Page indexing</strong> report in Search Console, which lists pages where Googlebot found a <code>noindex</code> rule.</li>

<li>Search <code>site:example.com/page-path</code> in Google. Google says <code>site:</code> results are not guaranteed or exhaustive, so a missing result is a hint, not proof.</li>
</ol>



<p class="wp-block-paragraph">If the page still appears after several weeks, confirm it is not blocked by robots.txt, returns the status code or header you expect, and that no other URL variation carries the same content. Related reading: <a href="https://www.thecodebuzz.com/node-js-bulk-submit-urls-google-search-console/">submit URLs to Google Search Console with Node.js</a>.</p>



<h2 class="wp-block-heading" id="faq">Frequently asked questions</h2>



<h3 class="wp-block-heading">Does blocking a URL in robots.txt remove it from Google?</h3>



<p class="wp-block-paragraph">No. It stops crawling, but the URL can still be indexed if other pages link to it, and Google cannot see a noindex tag on a blocked page. Use 404/410, password protection or noindex instead.</p>



<h3 class="wp-block-heading">Is the Removals tool permanent?</h3>



<p class="wp-block-paragraph">No. A successful request lasts about six months. Combine it with a permanent fix: delete the page (404 or 410), password-protect it, or add noindex.</p>



<h3 class="wp-block-heading">Can I remove a page from Google that I do not own?</h3>



<p class="wp-block-paragraph">You cannot use the Removals tool, but you can request a refresh of outdated content, or use Google&#8217;s form to remove certain personal information. Otherwise contact the site owner.</p>



<h2 class="wp-block-heading" id="summary">Summary</h2>



<p class="wp-block-paragraph">To remove a URL from Google, hide it fast with the Removals tool, then make it permanent with a 404/410, a password or a noindex rule that Google can crawl. Do not rely on robots.txt alone. The Indexing API is only for job posting and livestream pages. Verify with URL Inspection and give Google time to recrawl.</p>



<div class="wp-block-group has-background" style="border-radius:8px;background-color:#b6d9ac;padding-top:20px;padding-right:24px;padding-bottom:20px;padding-left:24px"><div class="wp-block-group__inner-container is-layout-constrained wp-container-core-group-is-layout-0d2d72cd wp-block-group-is-layout-constrained">
<p class="wp-block-paragraph" style="font-size:20px"><strong>Found this useful?</strong></p>



<p class="wp-block-paragraph">Bookmark this page and share it with your team. Get new .NET, cloud and database tutorials in your inbox.</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noopener">Subscribe to TheCodeBuzz</a></div>
</div>
</div></div>



<script type="application/ld+json">{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "Does blocking a URL in robots.txt remove it from Google?", "acceptedAnswer": {"@type": "Answer", "text": "No. It stops crawling, but the URL can still be indexed if other pages link to it, and Google cannot see a noindex tag on a blocked page. Use 404/410, password protection or noindex instead."}}, {"@type": "Question", "name": "Is the Removals tool permanent?", "acceptedAnswer": {"@type": "Answer", "text": "No. A successful request lasts about six months. Combine it with a permanent fix: delete the page (404 or 410), password-protect it, or add noindex."}}, {"@type": "Question", "name": "Can I remove a page from Google that I do not own?", "acceptedAnswer": {"@type": "Answer", "text": "You cannot use the Removals tool, but you can request a refresh of outdated content, or use Google's form to remove certain personal information. Otherwise contact the site owner."}}]}</script><p>The post <a href="https://thecodebuzz.com/how-to-remove-website-urls-google-search-indexing-or-crawling-api/">Remove a URL from Google Search: Removals, noindex, 404</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/how-to-remove-website-urls-google-search-indexing-or-crawling-api/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Task Scheduler 0x1 and 0x2 Error in Windows: How to Fix</title>
		<link>https://thecodebuzz.com/task-scheduler-0x1-and-0x2-error-in-windows/</link>
					<comments>https://thecodebuzz.com/task-scheduler-0x1-and-0x2-error-in-windows/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 08 Sep 2022 00:48:00 +0000</pubDate>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[0x1 task scheduler powershell]]></category>
		<category><![CDATA[0x1 task scheduler windows 10]]></category>
		<category><![CDATA[0x3 task scheduler]]></category>
		<category><![CDATA[0x41301 task scheduler error]]></category>
		<category><![CDATA[how to fix task scheduler 0x1 error]]></category>
		<category><![CDATA[Task Scheduler (0x1) and (0x2) Error In Windows]]></category>
		<category><![CDATA[task scheduler 0x0]]></category>
		<category><![CDATA[task scheduler 0x1 batch file]]></category>
		<category><![CDATA[task scheduler 0x1 python]]></category>
		<category><![CDATA[task scheduler 0x1 system account]]></category>
		<category><![CDATA[task scheduler 0x41301]]></category>
		<category><![CDATA[task scheduler last run result 0x1]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=23455</guid>

					<description><![CDATA[<p>Fix Windows Task Scheduler 0x1 and 0x2 errors for Python, PowerShell and EXE tasks by correcting the script path and the Start in folder, step by step.</p>
<p>The post <a href="https://thecodebuzz.com/task-scheduler-0x1-and-0x2-error-in-windows/">Task Scheduler 0x1 and 0x2 Error in Windows: How to Fix</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">How to fix Task Scheduler (0x1) Error In Windows</h1>



<h2 class="wp-block-heading">Issue Description</h2>



<p class="wp-block-paragraph">Task Scheduler when run produces (<em><strong>0x1</strong></em>) or (<em><strong>0x2</strong></em>) error In Windows.</p>



<p class="wp-block-paragraph"></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-resolution">Resolution</a></li><li><a href="#aioseo-resolution-for-python-task-scheduler-0x1-and-0x2-error">Python Task Scheduler (0x1) and (0x2) Error</a></li><li><a href="#aioseo-resolution-for-powershell-task-scheduler-0x1-and-0x2-error">Powershell Task Scheduler (0x1) and (0x2) Error</a></li><li><a href="#aioseo-resolution-for-exe-task-scheduler-0x1-and-0x2-error">Exe Task Scheduler (0x1) and (0x2) Error</a></li></ul></div>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-resolution">Resolution</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">The&nbsp;most&nbsp;common&nbsp;error with&nbsp;windows&nbsp;scheduled&nbsp;jobs&nbsp;is&nbsp;task&nbsp;scheduler&nbsp;error&nbsp;(<em><strong>0x1) </strong></em>or (<em><strong>0x2) </strong></em>errors. </p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">The main reason for the issue is due to the path of the script or exe specified. The&nbsp;Job&nbsp;scheduler&nbsp;(0x1)&nbsp;error&nbsp;is&nbsp;deal with the&nbsp;system&nbsp;path,&nbsp;which&nbsp;prevents&nbsp;your&nbsp;task&nbsp;from&nbsp;running&nbsp;since&nbsp;it&nbsp;can&#8217;t&nbsp;locate&nbsp;a&nbsp;file&nbsp;to&nbsp;run.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">To fix the issue, use the below steps,</p>



<p class="wp-block-paragraph"></p>



<ol class="wp-block-list"><li>Open Task scheduler by clicking start and typing in “Task Scheduler”</li><li>Click task scheduler library</li><li>Right-click on the required task and select properties</li><li>Click the actions tab</li><li>Click edit</li></ol>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Click on the “Action” tab and define the configuration</strong></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-resolution-for-python-task-scheduler-0x1-and-0x2-error">Python Task Scheduler (0x1) and (0x2) Error</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Please specify the following parameters:</p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list"><li><strong>Action:&nbsp;</strong>Start a program</li><li><strong>Program\script:</strong>&nbsp;[Exe name or paths like Python.exe or cmd.exe or PowerShell location]</li><li><strong>Add arguments (optional):</strong>&nbsp;[Add command line argument if any]</li><li><strong>Start in(optional):</strong>&nbsp;[directory path where python script exist]</li></ul>



<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="1024" height="721" src="https://www.thecodebuzz.com/wp-content/uploads/2022/09/schedule-python-script-batch-task-scheduler-1024x721.jpg" alt="python Task Scheduler (0x1) error windows" class="wp-image-23447" srcset="https://thecodebuzz.com/wp-content/uploads/2022/09/schedule-python-script-batch-task-scheduler-1024x721.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2022/09/schedule-python-script-batch-task-scheduler-300x211.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2022/09/schedule-python-script-batch-task-scheduler-768x541.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2022/09/schedule-python-script-batch-task-scheduler-738x520.jpg 738w, https://thecodebuzz.com/wp-content/uploads/2022/09/schedule-python-script-batch-task-scheduler.jpg 1418w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-resolution-for-powershell-task-scheduler-0x1-and-0x2-error">Powershell Task Scheduler (0x1) and (0x2) Error</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Please specify the following parameters:</p>



<ul class="wp-block-list"><li><strong>Action:&nbsp;</strong>Start a program</li><li><strong>Program\script:</strong>&nbsp;[ powershell ]</li><li><strong>Add arguments (optional):</strong>&nbsp;[Add command line argument if any]</li><li><strong>Start in(optional):</strong>&nbsp;[directory path where python script exist]</li></ul>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image is-resized"><a href="https://www.thecodebuzz.com/schedule-powershell-script-using-windows-task-scheduler/" target="_blank" rel="noopener"><img decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-script-task-scheduler.jpg" alt="PowerShell Task Scheduler (0x1) error" width="572" height="629"/></a></figure>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-resolution-for-exe-task-scheduler-0x1-and-0x2-error">Exe Task Scheduler (0x1) and (0x2) Error </h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Please specify the following parameters:</p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list"><li><strong>Action:&nbsp;</strong>Start a program</li><li><strong>Program\script:</strong>&nbsp;[ exe path ]</li><li><strong>Add arguments (optional):</strong>&nbsp;[Add command line argument if any]</li><li><strong>Start in(optional):</strong>&nbsp;[directory path where exe exist]</li></ul>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image is-resized"><a href="https://www.thecodebuzz.com/schedule-run-exe-console-application-windows-task-scheduler/" target="_blank" rel="noopener"><img decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/schedule-exe-batch-task-scheduler.jpg" alt="" width="470" height="521"/></a></figure>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph" style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size wp-block-paragraph"></p>



<p class="wp-block-paragraph" style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size wp-block-paragraph"></p>



<p class="has-medium-font-size wp-block-paragraph"><strong>Happy Coding </strong>!!</p>



<p class="wp-block-paragraph"></p>



<hr>



<p class="wp-block-paragraph"></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2026) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p><p>The post <a href="https://thecodebuzz.com/task-scheduler-0x1-and-0x2-error-in-windows/">Task Scheduler 0x1 and 0x2 Error in Windows: How to Fix</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/task-scheduler-0x1-and-0x2-error-in-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Task scheduler PowerShell example and guidelines</title>
		<link>https://thecodebuzz.com/schedule-powershell-script-using-windows-task-scheduler/</link>
					<comments>https://thecodebuzz.com/schedule-powershell-script-using-windows-task-scheduler/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 22 Jun 2022 14:35:00 +0000</pubDate>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[automate powershell script without task scheduler]]></category>
		<category><![CDATA[create task scheduler powershell]]></category>
		<category><![CDATA[powershell script to create scheduled task with credentials]]></category>
		<category><![CDATA[PowerShell Script using Windows Task Scheduler]]></category>
		<category><![CDATA[PowerShell Script Windows Task Scheduler]]></category>
		<category><![CDATA[powershell task]]></category>
		<category><![CDATA[PowerShell Task Scheduler]]></category>
		<category><![CDATA[PowerShell Windows Task Scheduler]]></category>
		<category><![CDATA[run powershell script automatically]]></category>
		<category><![CDATA[run powershell script from task scheduler with parameters]]></category>
		<category><![CDATA[schedule powershell script to run every hour]]></category>
		<category><![CDATA[task scheduler powershell script not running]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=16574</guid>

					<description><![CDATA[<p>Today in this article, we will see how to use Task Scheduler PowerShell with an example. We will schedule PowerShell Script using Windows Task Scheduler and automate PowerShell script execution. Today in this article, we shall see below There are many advantages of the Tasks scheduler, some of which are listed below, Let’s see in [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/schedule-powershell-script-using-windows-task-scheduler/">Task scheduler PowerShell example and guidelines</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<figure class="wp-block-image size-large"><a href="https://www.thecodebuzz.com/schedule-powershell-script-using-windows-task-scheduler/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" width="1024" height="406" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-scripts-task-scheduler-daily-task-1024x406.jpg" alt="how-to-run-a-powershell-script" class="wp-image-16585" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-scripts-task-scheduler-daily-task-1024x406.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-scripts-task-scheduler-daily-task-300x119.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-scripts-task-scheduler-daily-task-768x305.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-scripts-task-scheduler-daily-task-1536x609.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-scripts-task-scheduler-daily-task-785x311.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-scripts-task-scheduler-daily-task.jpg 1631w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p class="wp-block-paragraph">Today in this article, we will see how to use Task Scheduler PowerShell with an example. We will schedule <strong><em>PowerShell </em></strong>Script using Windows Task Scheduler and automate PowerShell script execution.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Today in this article, we shall see below</p>



<p class="wp-block-paragraph"></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-create-tasks-in-task-scheduler">Create Tasks Scheduler PowerShell Job</a></li><li><a href="#aioseo-define-general-configuration-for-powershell-job">Define general configuration for Powershell Job</a></li><li><a href="#aioseo-configure-the-tasks-in-task-scheduler">Configure Powershell Tasks in the Task Scheduler</a></li><li><a href="#aioseo-configure-powershell-action-in-task-scheduler">Configure Action in Task scheduler PowerShell</a></li><li><a href="#aioseo-configure-condition-in-task-scheduler">Configure Condition in Task Scheduler</a></li></ul></div>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">There are many advantages of the Tasks scheduler, some of which are listed below,</p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li><em>Automate the Job/Task</em></li>



<li><em>Schedule tasks at a predefined schedule.</em></li>



<li><em>Schedule the task as per predefined priority.</em></li>



<li><em>Improves turnaround time by a running script at a convenient time. like nightly runs etc.</em></li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Let’s see in detail, how to schedule the PowerShell script through the Task scheduler.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-create-tasks-in-task-scheduler">Create Tasks Scheduler PowerShell Job</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Open the Tasks Scheduler Windows -&gt; search for <em><strong>Task scheduler</strong></em> or type <em><strong>taskschd.msc</strong></em> using Windows+R.</p>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-large is-resized"><a href="https://www.thecodebuzz.com/schedule-powershell-script-using-windows-task-scheduler/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" width="1024" height="385" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-1024x385.jpg" alt="Tasks Scheduler PowerShell" class="wp-image-16575" style="width:456px;height:171px" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-1024x385.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-300x113.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-768x289.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-785x295.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler.jpg 1477w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Click on &#8220;Create Task&#8221;</strong></p>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="671" height="698" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/create-task-in-scheduler.jpg" alt="schedule powershell script task scheduler" class="wp-image-16576" style="width:274px;height:285px" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/create-task-in-scheduler.jpg 671w, https://thecodebuzz.com/wp-content/uploads/2021/06/create-task-in-scheduler-288x300.jpg 288w, https://thecodebuzz.com/wp-content/uploads/2021/06/create-task-in-scheduler-500x520.jpg 500w" sizes="auto, (max-width: 671px) 100vw, 671px" /></figure>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-define-general-configuration-for-powershell-job">Define general configuration for Powershell Job </h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Define the below attributes,</p>



<ul class="wp-block-list">
<li><strong>Name </strong>&#8211; Define Application Name, </li>



<li><strong>Description </strong>&#8211; Define a description of the task</li>



<li>Security options- Please select the appropriate Radio button. We shall select the option &#8220;Run whether the user is logged on or not&#8221;
<ul class="wp-block-list">
<li><strong>Run with the highest privileges</strong> &#8211; To run the program with <strong><em>administrator privileges</em></strong>, its recommended to use this option</li>
</ul>
</li>
</ul>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="774" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/configure-task-in-windows-task-scheduler-1024x774.jpg" alt="PowerShell Script using Windows Task Scheduler" class="wp-image-16577" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/configure-task-in-windows-task-scheduler-1024x774.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/06/configure-task-in-windows-task-scheduler-300x227.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/06/configure-task-in-windows-task-scheduler-768x581.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/configure-task-in-windows-task-scheduler-688x520.jpg 688w, https://thecodebuzz.com/wp-content/uploads/2021/06/configure-task-in-windows-task-scheduler.jpg 1264w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-configure-the-tasks-in-task-scheduler">Configure Powershell Tasks in the Task Scheduler</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Click on the &#8220;Trigger&#8221; tab and define the configuration</strong></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">In the next step, please click on the &#8220;<strong>Trigger</strong>&#8221; tab and click on &#8220;New&#8221; to create a new trigger.</p>



<p class="wp-block-paragraph">You can define the condition of when to trigger the given task for example &#8220;On a schedule&#8221; or &#8220;On an event&#8221;  or &#8220;on logon&#8221; or &#8220;on an event&#8221; etc.</p>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="640" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-daily-task-1024x640.jpg" alt=" Run Powershell script using task scheduler to " class="wp-image-16578" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-daily-task-1024x640.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-daily-task-300x187.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-daily-task-768x480.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-daily-task-1536x960.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-daily-task-785x490.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-with-task-scheduler-daily-task.jpg 1708w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-configure-powershell-action-in-task-scheduler">Configure Action in Task scheduler PowerShell </h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Click on the &#8220;Action&#8221; tab and define the configuration</strong></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">In the next step, please click on the &#8220;<strong><strong>Action</strong></strong>&#8221; tab and click on &#8220;New&#8221; to create a new action.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Please specify the following parameters:</p>



<ul class="wp-block-list">
<li><strong>Action:&nbsp;</strong>Start a program</li>



<li><strong>Program\script:</strong>&nbsp;Powershell</li>



<li><strong>Add arguments (optional):</strong>&nbsp;-file&nbsp;<em>[script path]</em></li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">I have kept my script at the below path,</p>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="210" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/how-to-automate-powershell-scripts-with-task-scheduler-1024x210.jpg" alt="run powershell script using task scheduler" class="wp-image-16582" style="width:506px;height:103px" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/how-to-automate-powershell-scripts-with-task-scheduler-1024x210.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/06/how-to-automate-powershell-scripts-with-task-scheduler-300x62.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/06/how-to-automate-powershell-scripts-with-task-scheduler-768x158.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/how-to-automate-powershell-scripts-with-task-scheduler-785x161.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2021/06/how-to-automate-powershell-scripts-with-task-scheduler.jpg 1294w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="913" height="1005" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-script-task-scheduler.jpg" alt="Schedule PowerShell Script using Windows Task Scheduler" class="wp-image-16579" style="width:470px;height:517px" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-script-task-scheduler.jpg 913w, https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-script-task-scheduler-273x300.jpg 273w, https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-script-task-scheduler-768x845.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/schedule-powershell-script-task-scheduler-472x520.jpg 472w" sizes="auto, (max-width: 913px) 100vw, 913px" /></figure>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-configure-condition-in-task-scheduler">Configure Condition in Task Scheduler  </h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Click on the &#8220;Condition&#8221; tab and define the configuration</strong></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">In the next step, please click on the &#8220;<strong><strong><strong>Condition</strong></strong></strong>&#8221; tab and select the appropriate options.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">These additional conditions let you configure the task based on a specified selection. The task will not run if any conditions specified here are not met&#8230;</p>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="779" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-task-scheduler-daily-task-1024x779.jpg" alt="run powershell script using task scheduler,Task scheduler PowerShell " class="wp-image-16581" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-task-scheduler-daily-task-1024x779.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-task-scheduler-daily-task-300x228.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-task-scheduler-daily-task-768x584.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-task-scheduler-daily-task-684x520.jpg 684w, https://thecodebuzz.com/wp-content/uploads/2021/06/automate-powershell-scripts-task-scheduler-daily-task.jpg 1260w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Once configured, You should be able to run the PowerShell script using the task scheduler.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Reference </strong>:</p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/making-powershell-post-request-with-body-json-array/" title="Making a PowerShell POST request with body" target="_blank" rel="noreferrer noopener"><strong><em>Making a PowerShell POST request with body</em></strong></a></li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph" style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size wp-block-paragraph"></p>



<p class="wp-block-paragraph" style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size wp-block-paragraph"></p>



<p class="has-medium-font-size wp-block-paragraph"><strong>Happy Coding </strong>!!</p>



<p class="wp-block-paragraph"></p>



<hr>



<p class="wp-block-paragraph"></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2026) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p><p>The post <a href="https://thecodebuzz.com/schedule-powershell-script-using-windows-task-scheduler/">Task scheduler PowerShell example and guidelines</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/schedule-powershell-script-using-windows-task-scheduler/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Powershell Invoke-RestMethod GET and POST Example</title>
		<link>https://thecodebuzz.com/invoke-restmethod-get-post-example-with-parameters/</link>
					<comments>https://thecodebuzz.com/invoke-restmethod-get-post-example-with-parameters/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 03 Jan 2022 00:26:00 +0000</pubDate>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[invoke-restmethod : a parameter cannot be found that matches parameter]]></category>
		<category><![CDATA[invoke-restmethod authentication]]></category>
		<category><![CDATA[invoke-restmethod basic auth]]></category>
		<category><![CDATA[invoke-restmethod bearer token]]></category>
		<category><![CDATA[invoke-restmethod error handling]]></category>
		<category><![CDATA[Invoke-RestMethod GET Example]]></category>
		<category><![CDATA[Invoke-RestMethod POST Example]]></category>
		<category><![CDATA[invoke-restmethod response]]></category>
		<category><![CDATA[invoke-restmethod response headers]]></category>
		<category><![CDATA[invoke-restmethod vs invoke-webrequest]]></category>
		<category><![CDATA[invoke-restmethod where-object]]></category>
		<category><![CDATA[name 'authentication]]></category>
		<category><![CDATA[powershell invoke-restmethod json response]]></category>
		<category><![CDATA[powershell rest api authentication]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=16637</guid>

					<description><![CDATA[<p>Powershell Invoke-RestMethod GET and POST Example with parameters Today in this article, we shall see how to use the PowerShell invoke-restmethod utility method to perform API GET and POST requests with parameters. We shall cover below in today&#8217;s article, The&#160;Invoke-RestMethod&#160;cmdlet sends HTTP and HTTPS and also supports REST( Representational State transfer) requests to a WEB [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/invoke-restmethod-get-post-example-with-parameters/">Powershell Invoke-RestMethod GET and POST Example</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Powershell Invoke-RestMethod GET and POST Example with parameters</h1>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="438" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/Invoke-RestMethod-get-post-request-using-body-examples-1024x438.jpg" alt="powershell invoke-restmethod,POST Example,powershell Invoke-RestMethod " class="wp-image-16696" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/Invoke-RestMethod-get-post-request-using-body-examples-1024x438.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/06/Invoke-RestMethod-get-post-request-using-body-examples-300x128.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/06/Invoke-RestMethod-get-post-request-using-body-examples-768x328.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/Invoke-RestMethod-get-post-request-using-body-examples-785x336.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2021/06/Invoke-RestMethod-get-post-request-using-body-examples.jpg 1532w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Today in this article, we shall see how to use the PowerShell <strong>invoke-restmethod </strong>utility method to perform API GET and POST requests with parameters. </p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">We shall cover below in today&#8217;s article,</p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-powershell-invoke-restmethod-get-request">Powershell Invoke-RestMethod GET request</a></li><li><a href="#aioseo-invoke-restmethod-post-request">Powershell Invoke-RestMethod POST request</a></li><li><a href="#aioseo-invoke-restmethod-post-request-with-headers">Powershell Invoke-RestMethod POST request with Headers</a></li><li><a href="#aioseo-powershell-post-request-with-json-array-example">Powershell  Post request with JSON array example</a></li><li><a href="#aioseo-powershell-invoke-restmethod-post-request-with-authentication-headers">Powershell Invoke-RestMethod POST request with Authentication headers</a><ul><li><a href="#aioseo-jwt-bearer-authentication-using-powershell">JWT Bearer Authentication using Powershell</a></li><li><a href="#aioseo-basic-authentication-with-powershell">Basic Authentication with PowerShell</a></li></ul></li></ul></div>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">The&nbsp;<code><strong>Invoke-RestMethod</strong></code>&nbsp;<strong><em>cmdlet </em></strong>sends HTTP and HTTPS and also supports REST( Representational State transfer) requests to a WEB API or service. It efficiently deals with <strong><em>JSON and XML </em></strong>content.</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-powershell-invoke-restmethod-get-request">Powershell Invoke-RestMethod GET request </h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Below is the <strong>Invoke-RestMethod</strong> GET request example.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Example</strong></p>



<p class="wp-block-paragraph"></p>



<pre class="wp-block-preformatted has-medium-font-size">PS C:\Test\File\load-sqldata&gt;  Invoke-RestMethod https://catfact.ninja/fact

fact                                                                                                                                                                     
----                                                                                                                                                                     
Researchers are unsure exactly how a cat purrs. Most veterinarians believe that a cat purrs by vibrating vocal folds deep in the throat. To do this, a muscle in the l..

</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="103" src="https://www.thecodebuzz.com/wp-content/uploads/2021/06/making-a-Invoke-RestMethod-get-post-request-using-body-1024x103.jpg" alt="Invoke-RestMethod POST with JWT bearer, invoke-restmethod" class="wp-image-16693" srcset="https://thecodebuzz.com/wp-content/uploads/2021/06/making-a-Invoke-RestMethod-get-post-request-using-body-1024x103.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/06/making-a-Invoke-RestMethod-get-post-request-using-body-300x30.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/06/making-a-Invoke-RestMethod-get-post-request-using-body-768x78.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/06/making-a-Invoke-RestMethod-get-post-request-using-body-1536x155.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2021/06/making-a-Invoke-RestMethod-get-post-request-using-body-2048x207.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2021/06/making-a-Invoke-RestMethod-get-post-request-using-body-785x79.jpg 785w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-invoke-restmethod-post-request">Powershell Invoke-RestMethod POST request</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Let&#8217;s look at the <strong>Invoke-RestMethod</strong> POST request example below.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Below is an equivalent body parameter example in PowerShell,</p>



<p class="wp-block-paragraph"></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [1]; title: ; notranslate">
$body = @{
    &quot;siteUrl&quot; =&quot;https://www.thecodebuzz.com&quot;
    &quot;email&quot; = &quot;info1@thecodebuzz.com&quot;
}
</pre></div>


<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Below is the POST method example using<strong>&nbsp;Invoke-RestMethod</strong>,</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Example</strong></p>



<p class="wp-block-paragraph"></p>



<pre class="wp-block-preformatted has-medium-font-size">Invoke-RestMethod -Method 'Post' -Uri $url -Body ($body|ConvertTo-Json) -Headers $headers -ContentType "application/json"</pre>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-invoke-restmethod-post-request-with-headers">Powershell Invoke-RestMethod POST request with Headers</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Let&#8217;s look at the <strong>Invoke-RestMethod</strong> POST request with headers example.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Powershell requests with headers can be defined as below,</p>



<p class="wp-block-paragraph"></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [1]; title: ; notranslate">
$headers = @{
 &#039;Content-Type&#039;=&#039;application/json&#039;
 &#039;apikey&#039;=&#039;475646456456&#039;
 }
</pre></div>


<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Below is the <strong>Invoke-RestMethod</strong> POST method example with Headers,</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Example</strong></p>



<p class="wp-block-paragraph"></p>



<pre class="wp-block-preformatted has-medium-font-size">Invoke-RestMethod -Method 'Post' -Uri $url -Body ($body|ConvertTo-Json) -Headers $headers -ContentType "application/json"

</pre>



<h2 class="wp-block-heading" id="aioseo-powershell-post-request-with-json-array-example">Powershell  Post request with JSON array example </h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Example here &#8211; <a href="https://www.thecodebuzz.com/powershell-generate-json-array-or-list/" target="_blank" rel="noopener" title="Use JSON array fields in a PowerShell script">Powershell  Post request with JSON array example </a></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading" id="aioseo-powershell-invoke-restmethod-post-request-with-authentication-headers">Powershell Invoke-RestMethod POST request with Authentication headers</h2>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Let&#8217;s look at the Invoke-RestMethod POST request with Authentication headers.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">APIs require you to authenticate via different authentication schemes like,</p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li>Basic authentication</li>
</ul>



<ul class="wp-block-list">
<li>OAuth token</li>
</ul>



<ul class="wp-block-list">
<li>JWT Bearer Authentication</li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">You can call Invoke-RestMethod POST request with Authentication headers like JWT bearer token as below,</p>



<p class="wp-block-paragraph"></p>



<h3 class="wp-block-heading" id="aioseo-jwt-bearer-authentication-using-powershell"><span style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color">JWT Bearer Authentication using Powershell </span></h3>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong><em>JSON Web Token( JWT)</em></strong>&nbsp;is an open standard used for securely transmitting information between parties as a JSON object.&nbsp;</p>



<p class="wp-block-paragraph">The client should always send the Authorization&nbsp;header with Bearer&nbsp;schema as below.</p>



<p class="wp-block-paragraph"><strong><em>Authorization: Bearer &lt;token&gt;</em></strong></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Example </strong>:</p>



<p class="wp-block-paragraph"></p>



<pre class="wp-block-preformatted has-medium-font-size">Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
eyJleHAiOjE1NzEwMDc3MzQsImlzcyI6Imh0dHBzOi8vbG9jYWxob3N0OjQ0MzQxIiwiYXVkIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NDQzNDEifQ.Ve2x6ueiHPyrP7wLjpmZrhx7QWrQKnkxWsu_1qUKKLA</pre>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Below is how the header can be defined to send with any request.</p>



<p class="wp-block-paragraph"></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [4]; title: ; notranslate">
$token&quot;=&#039;xxxxxxxxxxx&#039;
$headers = @{
 &#039;Content-Type&#039;=&#039;application/json&#039;
 &#039;Authorization&#039;= &#039;Bearer $token&#039;
 }
</pre></div>


<p class="wp-block-paragraph"><strong>Example</strong></p>



<p class="wp-block-paragraph"></p>



<pre class="wp-block-preformatted has-medium-font-size">Invoke-RestMethod -Method 'Post' -Uri $url -Body ($body|ConvertTo-Json) -Headers $headers
</pre>



<p class="wp-block-paragraph"></p>



<h3 class="wp-block-heading" id="aioseo-basic-authentication-with-powershell"><span style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color">Basic Authentication with PowerShel</span>l</h3>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Basic authentication&nbsp;is an Authentication Scheme built into the HTTP protocol which uses a simple username and password to access a restricted resource.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">If you have&nbsp;<strong><em>UserName&nbsp;</em></strong>and&nbsp;<em><strong>Password&nbsp;</strong></em>is as “<em><strong>Test</strong></em>“, “<em><strong>Password</strong></em>” then Base64 string token should be as below,</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Authorization</strong>:&nbsp;<strong>Basic&nbsp;<em>VGVzdDpQYXNzd29yZA===</em></strong></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Create base64 string using Powershell in detail in the below article,</p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/invoke-webrequest-with-a-username-and-password-basic-authentication/" target="_blank" rel="noreferrer noopener" title="Invoke-WebRequest with a username and password – Basic authentication"><em><strong>Invoke-WebRequest with a username and password – Basic authentication</strong></em></a></li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [4]; title: ; notranslate">
$token&quot;=&#039;xxxxxxxxxxx&#039; 
$headers = @{
 &#039;Content-Type&#039;=&#039;application/json&#039;
 &#039;Authorization&#039;= &#039;Basic $token&#039;
 }

</pre></div>


<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Once you add the required secured header, you simply call API using the below way,</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Example</strong></p>



<p class="wp-block-paragraph"></p>



<pre class="wp-block-preformatted has-medium-font-size">Invoke-RestMethod -Method 'Post' -Uri $url -Body ($body|ConvertTo-Json) -Headers $headers</pre>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong><em>References : </em></strong></p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/invoke-webrequest-vs-invoke-restmethod-differences/" target="_blank" rel="noreferrer noopener" title="Differences Invoke-WebRequest Vs Invoke-RestMethod"><strong><em>Differences Invoke-WebRequest Vs Invoke-RestMethod</em></strong></a></li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph" style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size wp-block-paragraph"></p>



<p class="wp-block-paragraph" style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size wp-block-paragraph"></p>



<p class="has-medium-font-size wp-block-paragraph"><strong>Happy Coding </strong>!!</p>



<p class="wp-block-paragraph"></p>



<hr>



<p class="wp-block-paragraph"></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2026) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p><p>The post <a href="https://thecodebuzz.com/invoke-restmethod-get-post-example-with-parameters/">Powershell Invoke-RestMethod GET and POST Example</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/invoke-restmethod-get-post-example-with-parameters/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Order Test cases by Display Name</title>
		<link>https://thecodebuzz.com/xunit-test-case-order-by-display-name/</link>
					<comments>https://thecodebuzz.com/xunit-test-case-order-by-display-name/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 10 Nov 2021 03:00:00 +0000</pubDate>
				<category><![CDATA[Automation]]></category>
		<category><![CDATA[Automation Testing]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=17551</guid>

					<description><![CDATA[<p>Test case Order (Unit Test or Functional Test) by Display Name Today in this article we shall cover how to execute and Order Test cases by Display Name As we already learned other techniques for ordering the test cases. Ordering on test cases can be achieved by any of the below mechanisms, Please see for [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/xunit-test-case-order-by-display-name/">How to Order Test cases by Display Name</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading"><strong>Test case Order (Unit Test or Functional Test) by Display Name</strong></h1>



<figure class="wp-block-image size-large"><a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noopener"><img loading="lazy" decoding="async" width="1024" height="391" src="https://www.thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-collection-name-1024x391.jpg" alt="XUnit Test case Order by Display Name" class="wp-image-17557" srcset="https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-collection-name-1024x391.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-collection-name-300x115.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-collection-name-768x293.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-collection-name-1536x587.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-collection-name-2048x783.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-collection-name-785x300.jpg 785w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p class="wp-block-paragraph">Today in this article we shall cover how to execute and Order Test cases by Display Name</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">As we already learned other techniques for ordering the test cases.</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Ordering on test cases can be achieved by any of the below mechanisms,</p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li><strong>Alphabetical </strong>&#8211; Order test method based on test name&#8217;s Alphabetical order</li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Please see for more details: <a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noopener" title="How to Order Unit Test cases – Guidelines"><em><strong>How to Order Unit Test cases by Alphabetical – Guidelines</strong></em></a></p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li><strong>Priority</strong>&#8211; Order test method based on test name&#8217;s using priority order set by the user providing better control on execution.</li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Please see for more details: <a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noreferrer noopener"><em><strong>How to Order Unit Test cases by </strong></em></a><em><strong><a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noreferrer noopener">Priority</a></strong></em><a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noreferrer noopener"><em><strong> – Guidelines</strong></em></a></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>DisplayName </strong>&#8211; Order test method based on test name&#8217;s DisplayName order we shall cover this in today&#8217;s article,</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Implement the <code><strong>ITestCaseOrderer</strong></code> and provide an ordering mechanism. </p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">With this, we will order the Test cases using the <strong><em>collection name</em></strong>.</p>



<p class="wp-block-paragraph"></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [8]; title: ; notranslate">
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Abstractions;

namespace OrechstrationService.Project
{
    public class DisplayNameOrderer : ITestCollectionOrderer
        {
            public IEnumerable&lt;ITestCollection&gt; OrderTestCollections(
                IEnumerable&lt;ITestCollection&gt; testCollections) =&gt;
                testCollections.OrderBy(collection =&gt; collection.DisplayName);
        }

}

</pre></div>


<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong><em>TestCaseOrderer </em></strong>now can be defined using <em><strong>DisplayNameOrderer </strong></em>as below. Please note to add below two attributes on the test cases namespace used for the test project,</p>



<p class="wp-block-paragraph"></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
&#x5B;assembly: CollectionBehavior(DisableTestParallelization = true)]
&#x5B;assembly: TestCollectionOrderer(&quot;OrechstrationService.Project.DisplayNameOrderer&quot;, &quot;OrechstrationService.Project&quot;)]
</pre></div>


<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">One can define the collection name using the Collection attribute as below. </p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Here you can decorate the test class with the collection names, Ex. Saving Account TestCollection</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong>Example</strong></p>



<p class="wp-block-paragraph"></p>



<pre class="wp-block-preformatted">[Collection("Saving Account TestCollection")]

<code>[Collection("Credit Account TestCollection")]</code>

[Collection("Bank AccountTest Collection")]
</pre>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Here below is a complete example,</p>



<p class="wp-block-paragraph"></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [10,31,53]; title: ; notranslate">
using Xunit;


// Need to turn off test parallelization so we can validate the run order
&#x5B;assembly: CollectionBehavior(DisableTestParallelization = true)]
&#x5B;assembly: TestCollectionOrderer(&quot;OrechstrationService.Project.DisplayNameOrderer&quot;, &quot;OrechstrationService.Project&quot;)]
namespace OrechstrationService.Project.Http
{

    &#x5B;Collection(&quot;Saving Account TestCollection&quot;)]
    public class HttpHelperClassTests1
    {
        public static bool SavingAccountTestCollection;

        &#x5B;Fact]
        public static void SavinggAccountController_OnGetAccount_Valid_HTTPClient()
        {
            //Arrange

            //Act

            //Assert
            Assert.True(HttpHelperClassTests2.CreditAccountTestCollection);
            Assert.True(HttpHelperClassTests3.BankAccountTestCollection);
            SavingAccountTestCollection = true;


        }
    }

    &#x5B;Collection(&quot;Credit Account TestCollection&quot;)]
    public class HttpHelperClassTests2
    {
        public static bool CreditAccountTestCollection;


        &#x5B;Fact]
        public static void CreditController_OnGetAccount_Valid_Typed_HTTPClient()
        {

            //Arrange

            //Act

            //Assert
            Assert.False(HttpHelperClassTests1.SavingAccountTestCollection);    
            Assert.True(HttpHelperClassTests3.BankAccountTestCollection);
            CreditAccountTestCollection = true;
        }

    }

    &#x5B;Collection(&quot;Bank AccountTest Collection&quot;)]
    public class HttpHelperClassTests3
    {
        public static bool BankAccountTestCollection;

        &#x5B;Fact]
        public static void BankController_OnGetAccount_Valid_Typed_HTTPClient()
        {

            //Arrange

            //Act

            //Assert

            Assert.False(HttpHelperClassTests1.SavingAccountTestCollection);
            Assert.False(HttpHelperClassTests2.CreditAccountTestCollection);
            BankAccountTestCollection = true;

        }

    }
}

</pre></div>


<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Once executed test cases execution order will be as per the collection name order alphabetically,</p>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-display-name-collection-1024x328.jpg" alt="Order Test cases by Display Name" class="wp-image-17554" width="725" height="232" srcset="https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-display-name-collection-1024x328.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-display-name-collection-300x96.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-display-name-collection-768x246.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-display-name-collection-1536x491.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-display-name-collection-785x251.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2021/08/ordered-test-cases-by-display-name-collection.jpg 1607w" sizes="auto, (max-width: 725px) 100vw, 725px" /></figure>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"><strong><em>References </em></strong>:</p>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noreferrer noopener" title="How to Order Unit Test cases – Guidelines"><em><strong>How to Order XUnit Test cases by Alphabetical – Guidelines</strong></em></a></li>
</ul>



<p class="wp-block-paragraph"></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noreferrer noopener"><em><strong>How to Order XUnit Test cases by </strong></em></a><em><strong><a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noreferrer noopener">Priority</a></strong></em><a href="https://www.thecodebuzz.com/order-unit-test-cases-or-integration-testing-guidelines/" target="_blank" rel="noreferrer noopener"><em><strong> – Guidelines</strong></em></a></li>
</ul>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph" style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size wp-block-paragraph"></p>



<p class="wp-block-paragraph" style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size wp-block-paragraph"></p>



<p class="has-medium-font-size wp-block-paragraph"><strong>Happy Coding </strong>!!</p>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p>



<hr>



<p class="wp-block-paragraph"></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2026) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph"></p><p>The post <a href="https://thecodebuzz.com/xunit-test-case-order-by-display-name/">How to Order Test cases by Display Name</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/xunit-test-case-order-by-display-name/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
