<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: Running PowerShell Scripts As a Scheduled Task	</title>
	<atom:link href="https://www.carlwebster.com/running-powershell-scripts-scheduled-task/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.carlwebster.com/running-powershell-scripts-scheduled-task/</link>
	<description>The Accidental Citrix Admin - The site for those who find themselves supporting Citrix involuntarily or accidentally</description>
	<lastBuildDate>Sat, 06 Nov 2021 11:45:02 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: Carl Webster		</title>
		<link>https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-10551</link>

		<dc:creator><![CDATA[Carl Webster]]></dc:creator>
		<pubDate>Tue, 21 Apr 2020 10:57:07 +0000</pubDate>
		<guid isPermaLink="false">https://www.carlwebster.com/?p=10724#comment-10551</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-10548&quot;&gt;René&lt;/a&gt;.

From Guy Leech:

It depends on what account you have set the scheduled task to run as. My &lt;a href=&quot;https://github.com/guyrleech/Citrix/blob/master/DailyChecks.ps1&quot; title=&quot;daily checks script&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer nofollow ugc&quot;&gt;daily checks script&lt;/a&gt; which uses the PVS cmdlets works fine when set to &quot;Run whether user is logged on or not&quot;. That script uses Set-PvsConnection which can take credentials if necessary but hopefully the account you are running the scheduled task as has PVS rights.

If scripts like this run but never finish it suggests to me that they are prompting for authentication but as they are running lights out, that authentication prompt never shows and thus never happens - I&#039;ve seen it with Connect-VIServer with PowerCLI.

Regards,

Guy]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-10548">René</a>.</p>
<p>From Guy Leech:</p>
<p>It depends on what account you have set the scheduled task to run as. My <a href="https://github.com/guyrleech/Citrix/blob/master/DailyChecks.ps1" title="daily checks script" target="_blank" rel="noopener noreferrer nofollow ugc">daily checks script</a> which uses the PVS cmdlets works fine when set to &#8220;Run whether user is logged on or not&#8221;. That script uses Set-PvsConnection which can take credentials if necessary but hopefully the account you are running the scheduled task as has PVS rights.</p>
<p>If scripts like this run but never finish it suggests to me that they are prompting for authentication but as they are running lights out, that authentication prompt never shows and thus never happens &#8211; I&#8217;ve seen it with Connect-VIServer with PowerCLI.</p>
<p>Regards,</p>
<p>Guy</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: René		</title>
		<link>https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-10548</link>

		<dc:creator><![CDATA[René]]></dc:creator>
		<pubDate>Tue, 21 Apr 2020 09:55:56 +0000</pubDate>
		<guid isPermaLink="false">https://www.carlwebster.com/?p=10724#comment-10548</guid>

					<description><![CDATA[Hi

is there a way to make a shedule task with the taskoption &quot;Run whether user is logged on or not&quot;? 
I have big problems with the &quot;PVS_Inventory_V5_Signed.ps1&quot;-Script. If i open an powershell with the serviceAccount, the script passed sucessfully. if i try to use the shedule task, the task never ends and i dont see any error. Only the word process is running the hole time.

regards 

René]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>is there a way to make a shedule task with the taskoption &#8220;Run whether user is logged on or not&#8221;?<br />
I have big problems with the &#8220;PVS_Inventory_V5_Signed.ps1&#8221;-Script. If i open an powershell with the serviceAccount, the script passed sucessfully. if i try to use the shedule task, the task never ends and i dont see any error. Only the word process is running the hole time.</p>
<p>regards </p>
<p>René</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Guy Leech		</title>
		<link>https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-1494</link>

		<dc:creator><![CDATA[Guy Leech]]></dc:creator>
		<pubDate>Sun, 11 Mar 2018 17:42:51 +0000</pubDate>
		<guid isPermaLink="false">https://www.carlwebster.com/?p=10724#comment-1494</guid>

					<description><![CDATA[I use &quot;bypass&quot; in my scheduled task command line because the scope of that is just this invocation and I trust my own scripts (generally!). The unfortunate problem with PowerShell execution policies is that they are relatively easily circumvented. They can be useful to stop accidental execution of a potentially malicious script by a normal user but once you&#039;ve got admin rights execution policies can easily be bypassed.

When I&#039;m setting up XenApp servers, I&#039;ll generally set the policy to Restricted or AllSigned but for the latter you&#039;ll need your own code signing certificate to sign any script you want to run.

I wouldn&#039;t sweat over it - for a non-admin user, unless you&#039;ve got weak permissions or aren&#039;t patched, what&#039;s the worst that can happen? For admin users, as I&#039;ve already said, execution policies are all to easy to circumvent.]]></description>
			<content:encoded><![CDATA[<p>I use &#8220;bypass&#8221; in my scheduled task command line because the scope of that is just this invocation and I trust my own scripts (generally!). The unfortunate problem with PowerShell execution policies is that they are relatively easily circumvented. They can be useful to stop accidental execution of a potentially malicious script by a normal user but once you&#8217;ve got admin rights execution policies can easily be bypassed.</p>
<p>When I&#8217;m setting up XenApp servers, I&#8217;ll generally set the policy to Restricted or AllSigned but for the latter you&#8217;ll need your own code signing certificate to sign any script you want to run.</p>
<p>I wouldn&#8217;t sweat over it &#8211; for a non-admin user, unless you&#8217;ve got weak permissions or aren&#8217;t patched, what&#8217;s the worst that can happen? For admin users, as I&#8217;ve already said, execution policies are all to easy to circumvent.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Carl Webster		</title>
		<link>https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-1493</link>

		<dc:creator><![CDATA[Carl Webster]]></dc:creator>
		<pubDate>Sat, 10 Mar 2018 14:56:59 +0000</pubDate>
		<guid isPermaLink="false">https://www.carlwebster.com/?p=10724#comment-1493</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-1492&quot;&gt;Rob Ingenthron&lt;/a&gt;.

You can always run the Signed versions of the scripts. That way, there is nothing to bypass.

Webster]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-1492">Rob Ingenthron</a>.</p>
<p>You can always run the Signed versions of the scripts. That way, there is nothing to bypass.</p>
<p>Webster</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Rob Ingenthron		</title>
		<link>https://www.carlwebster.com/running-powershell-scripts-scheduled-task/comment-page-1/#comment-1492</link>

		<dc:creator><![CDATA[Rob Ingenthron]]></dc:creator>
		<pubDate>Sat, 10 Mar 2018 07:31:21 +0000</pubDate>
		<guid isPermaLink="false">https://www.carlwebster.com/?p=10724#comment-1492</guid>

					<description><![CDATA[Thanks for the post! You didn&#039;t mention anything about the PowerShell execution settings or signing. I don&#039;t think that you can just run these scripts as scheduled tasks without addressing the execution policy, and that&#039;s an area I don&#039;t fully comprehend. (Everyone here just sets everything to either &quot;bypass&quot; or &quot;unrestricted&quot;.) I just saw your second post on this topic but it just has &quot;bypass&quot;. I hope you can add another post to discuss running these tasks more securely with PowerShell. (Is bypass the best option?)

BTW, I ran across another site that has an interesting post regarding bypassing the execution policy:
https://blog.netspi.com/15-ways-to-bypass-the-powershell-execution-policy/]]></description>
			<content:encoded><![CDATA[<p>Thanks for the post! You didn&#8217;t mention anything about the PowerShell execution settings or signing. I don&#8217;t think that you can just run these scripts as scheduled tasks without addressing the execution policy, and that&#8217;s an area I don&#8217;t fully comprehend. (Everyone here just sets everything to either &#8220;bypass&#8221; or &#8220;unrestricted&#8221;.) I just saw your second post on this topic but it just has &#8220;bypass&#8221;. I hope you can add another post to discuss running these tasks more securely with PowerShell. (Is bypass the best option?)</p>
<p>BTW, I ran across another site that has an interesting post regarding bypassing the execution policy:<br />
<a href="https://blog.netspi.com/15-ways-to-bypass-the-powershell-execution-policy/" rel="nofollow ugc">https://blog.netspi.com/15-ways-to-bypass-the-powershell-execution-policy/</a></p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
