我正在vRealize Automation 7.2中构建蓝图,并且作为过程的一部分,我需要能够从远程位置执行代码。我知道我可以使用加密的属性来提供用户的凭据,然后在不同的用户上下文中执行脚本,但这是我唯一的选择吗?我在vRealize Orchestrator中看到可以更改执行工作流程的用户的凭据,但是我不确定这也不是我的最佳选择。
我找到了一种通过使用Powershell脚本将部署的计算机上的驱动器映射到网络位置的方法。
$driveLetter = "U"
$networkPath = "\\network\share"
$userName = "domain\username"
$password = "password"
$psDrive = Get-PSDrive -Name $driveLetter
if ($psDrive)
{
Remove-PSDrive $psDrive
}
$token = $password | ConvertTo-SecureString -AsPlainText -Force
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $userName, $token -ErrorAction Stop
$output = New-PSDrive -Name $driveLetter -Root $networkPath -PSProvider FileSystem -Credential $credentials -Persist -Scope Global
$driveLetter = $output.Name + ":"
然后,我可以使用vRealize Automation软件组件将生成的驱动器号映射到其他步骤的安装位置,并通过选中属性的“绑定”框并将“值”设置为ConnectionStep_1〜driveLetter属性,将属性绑定到该组件的属性。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句