DPM 2012在任务计划程序中运行powershell脚本

我遇到了一个问题,我运行一个自定义的PS脚本来创build系统连接到控制台。

我的PS脚本在DPM Management Shell中以交互方式运行时起作用。

我参考了这个网站: http : //social.technet.microsoft.com/Forums/en-US/dpmpowershell/thread/ef802ac3-b5c8-4b8d-a29b-8d4a24bd3eca/

我一直在cmd中testing脚本。

Connect-DPMServer : Unable to connect to contoso-dpm01.fake.com. (ID:948) Verify that the DPM service is running on this computer. At C:\Program Files\Microsoft System Center 2012\DPM\DPM\bin\Attach-ProductionS erver.ps1:49 char:31 

该脚本是一个简单的将计算机名称传递给Attach-ProductionServer.ps1的脚本

谢谢阅读。 – 保罗

这是我的脚本:

 param([string] $DPMServerName, [string] $PSFileList) if(!$args[0]) { if(!$DPMServerName) { $DPMServerName = "contoso-dpm01.fake.com" } } if(!$PSFileList) { $PSFileList = "\\Share1\DPM_LOGS.txt" } $UserName = "`$DomAdmin" $pwd = "Password" $Domain = "fake.com" $installPath = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection Manager\Setup" "UIInstallPath").UIInstallPath $dpmModuleFullPath = $installPath + "Modules\DataProtectionManager\DataProtectionManager.psd1" Import-Module $dpmModuleFullPath type $PSFileList | foreach -process { if (!$_.Equals("")) { .\Attach-ProductionServer.ps1 -DPMServerName $DPMServerName -PSName $_ -Username $UserName - Password $pwd -domain $Domain } } # Get the date $DateStamp = get-date -uformat "%m-%d-%y@%H-%M" rename-item $PSFileList $DateStamp