Power Shell社区扩展 - 未创建Zip文件。 ISE中遇到的错误

时间:2014-01-21 17:17:27

标签: powershell

我差不多完成了Power Shell脚本,但是,我正在尝试压缩包含网络共享中图像的文件夹。我为Power Shell社区扩展(http://pscx.codeplex.com/)添加/导入了名为pscx的模块。没有创建zip文件,我在ISE窗口中收到错误。

执行压缩的代码是:

Import-Module Pscx
cd $ZipFileCreationDir
write-zip -path $FolderToCompress -outputpath $ZipFileName -noclobber -quiet -flattenpaths -level 9 | move-item $AS2OutgoingDir

变量包含以下信息:

$ZipFileCreationDir = "\\10.0.100.3\www2.varietydistributors.com\catalog"
$FolderToCompress = "newpictures"
$ZipFileName = "vdi.zip"
$AS2OutgoingDir = "\\10.0.100.3\AS2_Outgoing"

遇到的错误是:

Import-Module : The specified module 'Pscx' was not loaded because no valid module file was found in any module directory.
At C:\Documents and Settings\Administrator.VDICORP\Desktop\ProcessOSImages.ps1:73 char:22
+         Import-Module <<<<  Pscx
+ CategoryInfo          : ResourceUnavailable: (Pscx:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Write-Zip : Cannot find drive. A drive with the name 'Microsoft.PowerShell.Core\FileSystem' does not exist.
At C:\Documents and Settings\Administrator.VDICORP\Desktop\ProcessOSImages.ps1:75 char:18
+         write-zip <<<<  -path $FolderToCompress -outputpath $ZipFileName -noclobber -quiet -flattenpaths -level 9 | move-item $AS2OutgoingDir
+ CategoryInfo          : ObjectNotFound: (Microsoft.PowerShell.Core\FileSystem:String) [Write-Zip], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Pscx.Commands.IO.Compression.WriteZipCommand

如果你能够,请提供帮助。提前致谢。简而言之,我正在尝试压缩位于\ 10.0.100.3 \ www2.varietydistributors.com \ catalog \ newpictures的文件夹,然后将zip文件移动到\ 10.0.100.3 \ AS2_Outgoing

然后我将代码更改为以下内容,然后重新启动ISE中的脚本:

    #Add-PSSnapin PSCX
    #. "$Pscx:ProfileDir\PscxConfig.ps1"
    #Import-Module Pscx
    cd "Microsoft.PowerShell.Core\FileSystem::$ZipFileCreationDir"
    write-zip -path $FolderToCompress -outputpath $ZipFileName -noclobber -quiet -flattenpaths -level 9 | move-item "Microsoft.PowerShell.Core\FileSystem::$AS2OutgoingDir"

然后我收到以下错误:

Write-Zip : Cannot find drive. A drive with the name 'Microsoft.PowerShell.Core\FileSystem' does not exist.
At C:\Documents and Settings\Administrator.VDICORP\Desktop\ProcessOSImages.ps1:75 char:18
+         write-zip <<<<  -path $FolderToCompress -outputpath $ZipFileName -noclobber -quiet -flattenpaths -level 9 | move-item "Microsoft.PowerShell.Core\FileSystem::$AS2OutgoingDir"
+ CategoryInfo          : ObjectNotFound: (Microsoft.PowerShell.Core\FileSystem:String) [Write-Zip], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Pscx.Commands.IO.Compression.WriteZipCommand

0 个答案:

没有答案