# Powershell & Archive Maintaince

Discussion created by wpurrer on Apr 2, 2010
Latest reply on Jul 24, 2014 by mariolandry

I like to write an task which "maintaince" the archives (reprocess) => and i also like to write this script in powershell.

The issue i have, that the piarchss -if xxx -of xxx somehow doesn't work in powershell (i looks like the arguments aren't processed to the piarchss)

( i found some issues on the internet with multiple arguments, but i still have no clue how to get this to work)

Here is my sourceffile .. maybe someone has an idea why ?

function ProcessFile{    Write-Host "Processing Archive"    $args[0]$tempname = $args[0] + "_Temp"$orgname = $args[0] Write-Host "Try to unregister" # Unregister Archive => works c:\pi\adm\piartool -au$orgname

Write-Host "Try to Rename"

# Rename both files
ren $orgname$tempname
ren $orgname".ann"$tempname".ann"

Write-Host "Try to Process"

# Process the Archives  => Idea A
$arg1 = '-if'$arg2 = $tempname$arg3 = '-of'
$arg4 =$orgname

$allArgs = @($arg1, $arg2,$arg3, $arg4) c:\pi\bin\piarchss$allArgs

# Process the Archives  => Idea B
c:\pi\bin\piarchss "-if","$tempname","-of","$orgname"

Write-Host "Try to Register"
# Register the Archive => works