0

我有类似的问题,我想在 Win 7 上安装 Ciscoemail,但它根本不起作用。我已经使用此脚本通过组策略在 Win XP 上成功安装了它

md c:\ciscoemail

if not exist c:\ciscoemail\CiscoEmailSecurity_7-2-0-039.exe copy \\Domain Name\cisco\CiscoEmailSecurity_7-2-0-039.exe c:\ciscoemail /Y
if not exist c:\ciscoemail\response_file.iss copy \\Domain Name\cisco\response_file.iss c:\ciscoemail /Y
del c:\ciscoemail\setup.log /f /q

if not exist C:\PROGRA~2\Cisco\CISCOI~1\CISCOE~1.DLL c:\ciscoemail\CiscoEmailSecurity_7-2-0-039.exe /s /v /qn /f1"c:\ciscoemail\response_file.iss"

有人可以协助将代码转换为 Powershell 代码。简单的步骤是:

  1. 将目录制作到本地 c 驱动器。

  2. 检查 ciscoemail 是否存在于本地 C 盘。

  3. 如果文件夹不存在,则创建文件夹并将 ciscoemail\CiscoEmailSecurity_7-2-0-039.exe 和 ciscoemail\response_file.iss 复制到 C 盘

  4. .exe(安装文件)

4

1 回答 1

0

基本翻译:

# In PowerShell, md is an alias to mkdir which 
# is a function for creating folders
$folder = md c:\ciscoemail

# copy is an alias for Copy-Item
if( -not(Test-Path -Path c:\ciscoemail\CiscoEmailSecurity_7-2-0-039.exe))
{
    copy -Path \\Domain Name\cisco\CiscoEmailSecurity_7-2-0-039.exe -Destination $folder.FullName
}

if( -not(Test-Path -Path c:\ciscoemail\response_file.iss))
{
    copy -Path \\Domain Name\cisco\response_file.iss -Destination $folder.FullName
}

if( Test-Path -Path c:\ciscoemail\setup.log )
{
    # del is an alias to Remove-Item
    del -Path c:\ciscoemail\setup.log -ErrorAction SilentlyContinue -Force
}        

if( -not(Test-Path -Path "C:\PROGRA~2\Cisco\CISCOI~1\CISCOE~1.DLL"))
{
    c:\ciscoemail\CiscoEmailSecurity_7-2-0-039.exe /s /v /qn /f1"c:\ciscoemail\response_file.iss"
}
于 2012-05-14T10:54:51.060 回答