VMware Cloud Community
coemsysadmin
Contributor
Contributor

SRM 6.1.1 + Powercli not working after upgrade from 5.1

Hi All,

we recently upgraded our virtual infrastructure to vmware 6.0 and SRM 6.1.1.

Now we are facing an issue with a powercli/powershell script that we call from a step in a recovery plan.

It only executes parts of the script.

- netapp sra command are working.

- vmware commands are not working

- set ip address commands are working.

but when i execute it directly on the srm server the whole script runs perfectly.

What am i missing?

SRM 6.1.1.13171

Powercli 5.5.0.5836

VMware VIX 1.12.1.33347

Data ONTAP Powershell Toolkit 3.0.0.90

NetApp SRA 2.1P

powershell Execution policy set to RemoteSigned

command in recovery step executed on SRM server:

c:\windows\system32\cmd.exe /C d:\scripts\host\redirect.cmd d:\scripts\host\create_dbserver_clone_4_test.ps1 > d:\Logs\host.log

redirect.cmd:

@echo off

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" "& '%1'"

create_dbserver_clone_4_test.ps1:

see attachment (passwords,hostnames, users and ip addresses are not the real ones of course)


Kind Regards


Ruurd Bakker

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership

Which PowerCLI version have you installed where these scripts are running?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
coemsysadmin
Contributor
Contributor

Hi i have Powercli 5.5.0.5836 installed.

Reply
0 Kudos
LucD
Leadership
Leadership

With "VMware commands" do you mean PowerCLI cmdlets?

Do you have some logging to share?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
coemsysadmin
Contributor
Contributor

Hi LucD,

yes i mean the powercli commands:

When i execute the script via powercli on the server the script runs perfect, but when it is triggered from the SRM plan it doesn't execute some parts of the script.

It also gives me no output or logging.

The following from the script works:

# Specify and Connect to the Filer

$napass = "password"

$password = ConvertTo-SecureString $napass -AsPlainText -Force

$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "srm_user",$password

Connect-NaController 1.1.2.6 -Credential $cred

# Create Volume Clone

New-NaVolClone $nvol $ovol -SpaceReserve none

# Set Lun Online

Set-NaLun /vol/$nvol/lun1 -Online

# Add Lun to InitiatorGroup

Add-NaLunMap /vol/$nvol/lun1 VMware

This isn't working from the script:

# Specify and Connect the vCenter Server

$vcserver = "host1"

# Recover Credentials from the Virtual Infrastructre Credential store

$Creds = Get-VICredentialStoreItem -Host host1 -File D:\Scripts\Default\passfile.xml

Connect-VIServer $vcserver -User $Creds.User -Password $Creds.Password

# Rescan for Datastores

Get-Cluster "Disaster Recovery" | get-vmhost | Get-VMHostStorage -RescanAllHBA -RescanVmfs

# Register Clone in Vcenter

$Datastores = "snap*"

$VMFolder = "SRM Tests"

$ESXHost = Get-Cluster "Disaster Recovery" | Get-VMHost | select -First 1

thanks in advance

Reply
0 Kudos
LucD
Leadership
Leadership

A pity there is no logging.

Did you already try using a Start-Transcript cmdlet?

Or writing explicitely to an output file with Out-File?

If the message is something like "Connect-VIServer : The term ‘Connect-VIServer’ is not recognized as the name of a cmdlet, function, script file, or operable progr", it might mean that the PSSnapin is not loaded.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
coemsysadmin
Contributor
Contributor

we are writing explicitely to an output file.

i will try to get some logging and will check if the snapin is loaded correctly.

thanks

Reply
0 Kudos