2016-04-04 6 views
0

//動作しない新しいPowerShellドライブを作成します場合msdeployソースパラメータのソース変数として新しい-PSDriveコマンド名を使用すると、

$psw = ConvertTo-SecureString %deployment.password% -AsPlainText -force 
$cred = new-object -TypeName System.Management.Automation.PSCredential -ArgumentList "MyUser, $psw 
New-PSDrive -Credential $cred -Name ImportFolder -PSProvider FileSystem -Root \\MyShare\Exchange\MyFolder 

//完全なソース・パスを作成します

$sourcePath = ImportFolder:\$versionPath\audio 

//展開と場合msdeployおよび$ソースパスは

$path = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"; 
$verb = "-verb:sync"; 
$src = "-source:contentPath=`"$sourcePath`""; 
$dest = "-dest:contentPath=%TargetIISPath%,wmsvc='%Computername%:%deployment.iis.port%/msdeploy.axd',username=%system.Username%,password=%system.Password%"; 
Invoke-Expression "&'$path' --% $verb $src $dest -verbose -allowUntrusted"; 

Remove-PSDrive ImportFolder 

私はエラーを取得する:

The term 'ImportFolder:\$versionPath\audio' is not recognized as the name of a 
[21:07:32][Step 6/7] cmdlet, function, script file, or operable program. Check the spelling of the 
[21:07:32][Step 6/7] name, or if a path was included, verify that the path is correct and try 
[21:07:32][Step 6/7] again.At 

問題 は

は、どのように私はそれを修正することができます...場合msdeployはsourcePathはImportFolderは文字通り「ImportFolder」と命名されていると仮定しますが、実際にそれがマッピングされたパスを持つPowerShellドライブであるということですか?

"net use X:\ path"は自分の環境でバグがありますので使用しないでください。

+1

でそのドライブ文字を使用することができ、その後あなたはその '$を囲みたいと思いますsourcePath'値を引用符で囲みます: '$ sourcePath =" ImportFolder:\ $ versionPath \ audio "'つまり、 'msdeploy.exe'はpsdriveを解決することができません(' msdeploy.exe'はPowerShellではないので) –

+0

あなたが言ったようにしましたが、理解できない別のエラーが発生しました。 。:エラーコード:ERROR_SITE_DOES_NOT_EXIST 詳細情報:サイト 'ImportFolder:'は存在しません。それは文字通り... – Elisabeth

+1

それは言い伝えたことです。あなたが '$ sourcePath'文字列を修正しても動作しません。 'msdeploy' **は苦労しません**。 –

答えて

0

これは少し古いかもしれませんが、あなたは自分のPSDriveのための文字で名前を使用することができますし、あなたがする場合msdeploy

New-PSDrive -Credential $cred -Name "X" -PSProvider FileSystem -Root \\MyShare\Exchange\MyFolder 

$sourcePath = "X:\$versionPath\audio" 
関連する問題