2017-10-04 3 views
0

Quand je lance le flux de travail powershell suivant:erreur UNC sur un flux de Powershell

Function Start-LocalRScript { 
    Param([Parameter(ValueFromPipeline, Mandatory)]$Name) 
    $ScriptPath = "C:\Exploration.RScripts" 
    $RScriptExePath = "C:\Program Files\R\R-3.1.2\bin\Rscript.exe" 
    $scriptPath = Join-Path -Path $ScriptPath -ChildPath $Name 
    & $RScriptExePath $scriptPath 
} 

Workflow Get-RScriptWorkflow { 
    Start-LocalRScript script1.R 
} 

Je reçois l'erreur suivante mais je reçois toujours le résultat du script R:

Rscript.exe : '\\srvuser01\profil\myUser\Documents' At Get-RScriptWorkflow:2 char:2 
+ CategoryInfo   : NotSpecified ('\\srvuser01\profil\myUser\Documents':String) [], RemoteException 
+ FullyQualifiedErrorId : NativeCommandError 
+ PSComputerName  : [localhost] 
CMD.EXE was started with the above path as the current directory. 
UNC paths are not supported. Defaulting to Windows directory. 
[1] "from script 1" 

Mais quand je exécutez la commande Start-LocalRScript script1.R il n'y a pas d'erreur. Il semble que le workflow essaye d'accéder au chemin local de mon utilisateur qui est dans le réseau pour RScript.exe même si je spécifie où RScript.exe est sur le script Start-LocalRScript. Est-ce que quelqu'un sait ce qui se passe ici?

Répondre

0

à la place de l'opérateur d'appel (&) utilisez Start-Process avec -WorkingDirectory défini sur le répertoire de travail approprié.