# Need help with Powershell unzip using SYSTEM account from task scheduler

**URL:** <https://forums.powershell.org/t/need-help-with-powershell-unzip-using-system-account-from-task-scheduler/4865>\
**Category:** PowerShell Help\
**Created:** [September 10, 2015, 11:57pm UTC](https://forums.powershell.org/t/need-help-with-powershell-unzip-using-system-account-from-task-scheduler/4865 "2015-09-10T23:57:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![windows-liveuser53](https://avatars.discourse-cdn.com/v4/letter/w/e0b2c6/32.png) [@windows-liveuser53](https://forums.powershell.org/u/windows-liveuser53)\
**Post date:** [September 10, 2015, 11:57pm UTC](https://forums.powershell.org/t/need-help-with-powershell-unzip-using-system-account-from-task-scheduler/4865/1 "2015-09-10T23:57:46Z")

</div>

I run multiple powershell scripts from task scheduler using the SYSTEM account. This is the only script that does not work. This script needs a Windows user account defined in task scheduler to run. Is there a way to get this script to work using the SYSTEM account? If not, is there another way to unzip files using powershell that does not have this requirement? Below is the code:

function Expand-ZIPFile  
{  
param($file, $destination)  
$shell = new-object -com shell.application  
$zip = $shell.NameSpace($file)  
foreach($item in $zip.items())  
{  
$shell.Namespace($destination).copyhere($item,1564)  
“$($item.path) extracted”  
}  
}

$hc\_zip = $args[0]  
$hc\_zip

$hc\_dest = $args[1]

if (Test-Path $hc\_zip){Expand-ZIPFile –File “$hc\_zip” –Destination "$hc\_dest”}  
else{Write-Output “Zip file does not exist…”}

---

<div class="post-metadata">

**Author:** ![bobmccoy](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/bobmccoy/32/650_2.png) [@bobmccoy](https://forums.powershell.org/u/bobmccoy)\
**Post date:** [September 11, 2015, 4:26am UTC](https://forums.powershell.org/t/need-help-with-powershell-unzip-using-system-account-from-task-scheduler/4865/2 "2015-09-11T04:26:22Z")

</div>

Have you tried using the NETWORK SERVICE?

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:44pm UTC](https://forums.powershell.org/t/need-help-with-powershell-unzip-using-system-account-from-task-scheduler/4865/3 "2024-05-16T20:44:47Z")

</div>


