I'm using the following powershell script to monitor new files coming
in an IBM iSeries shared folder.

```
# variables
#$folder = "\\10.10.0.120\transform\BE\FORM"
#$folder = "C:\Users\Administrator.ALI\Desktop\AS400"
#$folder = "\\nb091002\Temp"
$folder = "I:\"
$filter = "*.txt"
$aswform = "C:\ASWFORM\aswform.exe"

$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = $folder
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $false
$watcher.NotifyFilter = [System.IO.NotifyFilters]::LastWrite -bor [System.IO.NotifyFilters]::FileName

while($TRUE){
    $result = $watcher.WaitForChanged([System.IO.WatcherChangeTypes]::Changed -bor [System.IO.WatcherChangeTypes]::Renamed -bOr [System.IO.WatcherChangeTypes]::Created, 2000);
    if($result.TimedOut){
        continue;
    }
    Write-Host $result.Name
    #$aswform $folder

}

```

This seems to work fine on local folders or domain shares.  

I've tried mapping the iSeries shared folder to a network drive but it doesn't work.  

*(10.10.0.120 is the AS400)*

I'm pretty sure it has to do something with credentials....  

Strange thing is I can access the shared folder from within Windows perfectly.

Does anybody have any clues or tips for me?

PS: little detail, I'll be running this script through task sheduler with this trigger   

```
powershell -NoExit -WindowStyle Hidden -File "C:\ASWFORM\watcher.ps1"

```

But first I need it working when running the script manually!