<?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>Sun, 11 Feb 2024 04:03:30 +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>How to Remove Website URLs from Google search indexing or crawling</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>How to Remove Website URLs from Google search indexing or crawling Today in this article, we will see how to How to How to Remove Website URLs from Google search indexing or crawling. You might find genuine need of not crawling or indexing the website. But in today&#8217;s article, we will see a use case [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/how-to-remove-website-urls-google-search-indexing-or-crawling-api/">How to Remove Website URLs from Google search indexing or crawling</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">How to Remove Website URLs from Google search indexing or crawling</h1>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="764" height="400" src="https://www.thecodebuzz.com/wp-content/uploads/2023/12/python-remove-url-google-search-console-engine.jpg" alt="" class="wp-image-29251" srcset="https://thecodebuzz.com/wp-content/uploads/2023/12/python-remove-url-google-search-console-engine.jpg 764w, https://thecodebuzz.com/wp-content/uploads/2023/12/python-remove-url-google-search-console-engine-300x157.jpg 300w" sizes="(max-width: 764px) 100vw, 764px" /></figure>



<p>Today in this article, we will see how to How to How to Remove Website URLs from Google search indexing or crawling.</p>



<p></p>



<p>You might find genuine need of not crawling or indexing the website. </p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-few-common-reasons-for-removing-the-urls-are-as-below">Common Reasons for Removing the URLs</a></li><li><a href="#aioseo-remove-url-from-indexing-immediately-steps-by-step">Remove URL from Indexing Immediately &#8211; Manual</a></li><li><a href="#aioseo-make-url-removal-permanent">Remove URL permanently from Indexing</a></li><li><a href="#aioseo-remove-url-permanently-using-google-indexing-api">Remove URL permanently using Google Indexing API</a></li></ul></div>



<p></p>



<p>But in today&#8217;s article, we will see a use case where you already have website URL which is indexed but you want to remove the URL due to some reasons. </p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-few-common-reasons-for-removing-the-urls-are-as-below">Common Reasons for Removing the URLs</h2>



<p></p>



<p>Few common reasons for Removing the URLs are as below,</p>



<p></p>



<ul class="wp-block-list">
<li><strong>Private Content:</strong> To maintain privacy and security, website owners may restrict search engines from indexing certain pages or sections that contain data, internal documents, or private information.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Outdated Content:</strong> Some websites might have outdated or low-quality content that could harm the overall search engine rankings. User may want no longer relevant or accurate. </li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Temporary Pages:</strong> Under progress website with temporary pages that are not ready for public viewing might opt to exclude pages from search engine results.</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-remove-url-from-indexing-immediately-steps-by-step">Remove URL from Indexing Immediately &#8211; Manual</h2>



<p></p>



<ul class="wp-block-list">
<li>Login to Google Search console </li>
</ul>



<p></p>



<p><a href="https://search.google.com/search-console">https://search.google.com/search-console</a></p>



<p></p>



<ul class="wp-block-list">
<li>Select your website from the list of websites available </li>
</ul>



<p></p>



<figure class="wp-block-image size-full"><img decoding="async" width="776" height="245" src="https://www.thecodebuzz.com/wp-content/uploads/2023/12/image.jpg" alt="Remove Website URLs from Google search" class="wp-image-29242" srcset="https://thecodebuzz.com/wp-content/uploads/2023/12/image.jpg 776w, https://thecodebuzz.com/wp-content/uploads/2023/12/image-300x95.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2023/12/image-768x242.jpg 768w" sizes="(max-width: 776px) 100vw, 776px" /></figure>



<p></p>



<ul class="wp-block-list">
<li>Under Indexing option please click on &#8220;Removal&#8221;</li>
</ul>



<p></p>



<figure class="wp-block-image size-full"><img decoding="async" width="322" height="375" src="https://www.thecodebuzz.com/wp-content/uploads/2023/12/image-1.jpg" alt="" class="wp-image-29243" srcset="https://thecodebuzz.com/wp-content/uploads/2023/12/image-1.jpg 322w, https://thecodebuzz.com/wp-content/uploads/2023/12/image-1-258x300.jpg 258w" sizes="(max-width: 322px) 100vw, 322px" /></figure>



<p></p>



<ul class="wp-block-list">
<li>Under tab &#8220;Temporary Removals &#8221; please click on &#8220;NEW REQUEST&#8221;</li>
</ul>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="284" src="https://www.thecodebuzz.com/wp-content/uploads/2023/12/image-1024x284.png" alt="delete Website from Google search results" class="wp-image-29244" srcset="https://thecodebuzz.com/wp-content/uploads/2023/12/image-1024x284.png 1024w, https://thecodebuzz.com/wp-content/uploads/2023/12/image-300x83.png 300w, https://thecodebuzz.com/wp-content/uploads/2023/12/image-768x213.png 768w, https://thecodebuzz.com/wp-content/uploads/2023/12/image-785x218.png 785w, https://thecodebuzz.com/wp-content/uploads/2023/12/image.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<ul class="wp-block-list">
<li>Finally Submit the url as below,</li>
</ul>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="686" height="540" src="https://www.thecodebuzz.com/wp-content/uploads/2023/12/image-1.png" alt="" class="wp-image-29245" style="width:306px;height:auto" srcset="https://thecodebuzz.com/wp-content/uploads/2023/12/image-1.png 686w, https://thecodebuzz.com/wp-content/uploads/2023/12/image-1-300x236.png 300w, https://thecodebuzz.com/wp-content/uploads/2023/12/image-1-661x520.png 661w" sizes="auto, (max-width: 686px) 100vw, 686px" /></figure>



<p></p>



<p>Above step will remove URL only for 6 month. </p>



<p></p>



<p>To remove URL permanently please follow below guidelines. </p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-make-url-removal-permanent">Remove URL permanently from Indexing </h2>



<p></p>



<p>The above discussed removals tool removes the URL from google search for six months <em>temporar</em>ily&nbsp;. </p>



<p></p>



<p>If you want to remove content or a URL from Google search&nbsp;<em>permanently</em>, please follow the steps as below,</p>



<p></p>



<ul class="wp-block-list">
<li><strong>Remove the content of your site</strong>&nbsp;&#8211; Please remove images, pages, directories.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Update the content of your site</strong>&nbsp; to returns either a&nbsp;<code>404 (Not Found)</code>&nbsp;or&nbsp;<code>410 (Gone)</code>&nbsp;HTTP status code. </li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Update the content</strong> to be accessed through password.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li>Other possible option is using the&nbsp;<strong><em>noindex</em></strong> meta tag. </li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-remove-url-permanently-using-google-indexing-api">Remove URL permanently using Google Indexing API</h2>



<p></p>



<p>One can easily remove URLs from Google search using Indexing API and requesting URL to be removed from search results.</p>



<p></p>



<p>This way , you can achieve automation where you can specify which URLs to be removed from indexing or update the URLs etc. or add new indexing URL.</p>



<p></p>



<p>Below is sample code using Python to achieve the same. </p>



<p>We are using Indexing POST API call using JOSN schema where you need to specify URL and type of operation as &#8220;URL_DELETED&#8221; .</p>



<p></p>



<pre class="wp-block-code"><code>urlList=&#91;"url1","url2", "url3"]
for index, item in enumerate(urlList):
    content = {
      "url": item,
      "type": "URL_DELETED"
    }
    response, content = http.request(ENDPOINT, method="POST", body=json.dumps(content))
    print(response)</code></pre>



<p></p>



<p></p>



<p>For more details on how to setup Indexing API, please visit this article &#8211;<a href="https://www.thecodebuzz.com/how-to-bulk-submit-website-urls-index-google-search-engine-console-wordpress-crawling/" target="_blank" rel="noopener" title="How to Bulk Index and Crawl Website URLs To Google Search – SEO Automation"><strong><em>How to Bulk Index and Crawl Website URLs To Google Search – SEO Automation</em></strong></a></p>



<p></p>



<hr>



<p class=""></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 (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p>



<p></p>



<p></p>



<p></p><p>The post <a href="https://thecodebuzz.com/how-to-remove-website-urls-google-search-indexing-or-crawling-api/">How to Remove Website URLs from Google search indexing or crawling</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</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>How to fix Task Scheduler (0x1) Error In Windows Issue Description Task Scheduler when run produces (0x1) or (0x2) error In Windows. Resolution The&#160;most&#160;common&#160;error with&#160;windows&#160;scheduled&#160;jobs&#160;is&#160;task&#160;scheduler&#160;error&#160;(0x1) or (0x2) errors. The main reason for the issue is due to the path of the script or exe specified. The&#160;Job&#160;scheduler&#160;(0x1)&#160;error&#160;is&#160;deal with the&#160;system&#160;path,&#160;which&#160;prevents&#160;your&#160;task&#160;from&#160;running&#160;since&#160;it&#160;can&#8217;t&#160;locate&#160;a&#160;file&#160;to&#160;run. To fix the issue, use the below [&#8230;]</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</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>Task Scheduler when run produces (<em><strong>0x1</strong></em>) or (<em><strong>0x2</strong></em>) error In Windows.</p>



<p></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></p>



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



<p></p>



<p>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></p>



<p>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></p>



<p>To fix the issue, use the below steps,</p>



<p></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></p>



<p><strong>Click on the “Action” tab and define the configuration</strong></p>



<p></p>



<p></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></p>



<p>Please specify the following parameters:</p>



<p></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 loading="lazy" 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="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></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></p>



<p>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></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 loading="lazy" 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></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></p>



<p>Please specify the following parameters:</p>



<p></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></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 loading="lazy" 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></p>



<p></p>



<p 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"></p>



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



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



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



<p></p>



<hr>



<p class=""></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 (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p>



<p></p>



<p></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</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>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></p>



<p>Today in this article, we shall see below</p>



<p></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></p>



<p></p>



<p>There are many advantages of the Tasks scheduler, some of which are listed below,</p>



<p></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></p>



<p>Let’s see in detail, how to schedule the PowerShell script through the Task scheduler.</p>



<p></p>



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



<p></p>



<p>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></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></p>



<p><strong>Click on &#8220;Create Task&#8221;</strong></p>



<p></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></p>



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



<p></p>



<p>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></p>



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



<p></p>



<p><strong>Click on the &#8220;Trigger&#8221; tab and define the configuration</strong></p>



<p></p>



<p>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>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></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></p>



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



<p></p>



<p><strong>Click on the &#8220;Action&#8221; tab and define the configuration</strong></p>



<p></p>



<p>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></p>



<p>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></p>



<p>I have kept my script at the below path,</p>



<p></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></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></p>



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



<p></p>



<p><strong>Click on the &#8220;Condition&#8221; tab and define the configuration</strong></p>



<p></p>



<p>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></p>



<p>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></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></p>



<p>Once configured, You should be able to run the PowerShell script using the task scheduler.</p>



<p></p>



<p><strong>Reference </strong>:</p>



<p></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></p>



<p></p>



<p 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"></p>



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



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



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



<p></p>



<hr>



<p class=""></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 (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></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>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></p>



<p>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></p>



<p></p>



<p>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></p>



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



<p></p>



<p>Below is the <strong>Invoke-RestMethod</strong> GET request example.</p>



<p></p>



<p><strong>Example</strong></p>



<p></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></p>



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



<p></p>



<p>Let&#8217;s look at the <strong>Invoke-RestMethod</strong> POST request example below.</p>



<p></p>



<p>Below is an equivalent body parameter example in PowerShell,</p>



<p></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></p>



<p>Below is the POST method example using<strong>&nbsp;Invoke-RestMethod</strong>,</p>



<p></p>



<p><strong>Example</strong></p>



<p></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></p>



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



<p></p>



<p>Let&#8217;s look at the <strong>Invoke-RestMethod</strong> POST request with headers example.</p>



<p></p>



<p>Powershell requests with headers can be defined as below,</p>



<p></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></p>



<p>Below is the <strong>Invoke-RestMethod</strong> POST method example with Headers,</p>



<p></p>



<p><strong>Example</strong></p>



<p></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></p>



<p>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></p>



<p></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></p>



<p>Let&#8217;s look at the Invoke-RestMethod POST request with Authentication headers.</p>



<p></p>



<p>APIs require you to authenticate via different authentication schemes like,</p>



<p></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></p>



<p>You can call Invoke-RestMethod POST request with Authentication headers like JWT bearer token as below,</p>



<p></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></p>



<p><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>The client should always send the Authorization&nbsp;header with Bearer&nbsp;schema as below.</p>



<p><strong><em>Authorization: Bearer &lt;token&gt;</em></strong></p>



<p></p>



<p><strong>Example </strong>:</p>



<p></p>



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



<p></p>



<p>Below is how the header can be defined to send with any request.</p>



<p></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><strong>Example</strong></p>



<p></p>



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



<p></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></p>



<p>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></p>



<p>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></p>



<p><strong>Authorization</strong>:&nbsp;<strong>Basic&nbsp;<em>VGVzdDpQYXNzd29yZA===</em></strong></p>



<p></p>



<p>Create base64 string using Powershell in detail in the below article,</p>



<p></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></p>



<p></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></p>



<p>Once you add the required secured header, you simply call API using the below way,</p>



<p></p>



<p><strong>Example</strong></p>



<p></p>



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



<p></p>



<p><strong><em>References : </em></strong></p>



<p></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></p>



<p 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"></p>



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



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



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



<p></p>



<hr>



<p class=""></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 (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></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>Today in this article we shall cover how to execute and Order Test cases by Display Name</p>



<p></p>



<p>As we already learned other techniques for ordering the test cases.</p>



<p></p>



<p>Ordering on test cases can be achieved by any of the below mechanisms,</p>



<p></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></p>



<p>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></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></p>



<p>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></p>



<p><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></p>



<p>Implement the <code><strong>ITestCaseOrderer</strong></code> and provide an ordering mechanism. </p>



<p></p>



<p>With this, we will order the Test cases using the <strong><em>collection name</em></strong>.</p>



<p></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></p>



<p><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></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></p>



<p>One can define the collection name using the Collection attribute as below. </p>



<p></p>



<p>Here you can decorate the test class with the collection names, Ex. Saving Account TestCollection</p>



<p></p>



<p><strong>Example</strong></p>



<p></p>



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

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

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



<p></p>



<p>Here below is a complete example,</p>



<p></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></p>



<p>Once executed test cases execution order will be as per the collection name order alphabetically,</p>



<p></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></p>



<p><strong><em>References </em></strong>:</p>



<p></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></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></p>



<p></p>



<p 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"></p>



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



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



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



<p></p>



<p></p>



<hr>



<p class=""></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 (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></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>
