Powershell Authentication Help Post Server 2012 R2 Upgrade


We've recently upgraded our VMWare vCenter server from 2008 R2 to 2012 R2 and upgraded vCenter from 5.0.0 to 5.5.0.  Since then our SAM PS script that checks for snapshots (below) is failing with permissions.

Add-PSSnapin -Name VMware.VimAutomation.Core

#If you get an out of memory error on the vCenter Server run "set-item wsman:localhost\Shell\MaxMemoryPerShellMB 768"

function Get-Snaps{

    $vms = get-vm | where {$_.Name -ne "SERVER1"} | sort name

    $vmsnaps = @()


    $Age = 7

    foreach($vm in $vms){

    $snap = Get-Snapshot $vm


           $vmsnaps += $vm

     #write-host -fore green `n `t $vm

     $snapshots = Get-Snapshot $vm

     foreach ($snapshot in $snapshots){


                if ( $snapshot.Created -lt (Get-Date).AddDays( -$Age ) ) {

        $FSnapshots = $FSnapshots + "" + $vm + "</br>"







write-host "Message:"$FSnapshots

write-host "Statistic:"$i


Connect-VIServer ${ip} -WarningAction 0


Disconnect-VIServer -Force:$true -Confirm:$false

I've tried connecting on my vCenter server using the "Connect-VIServer <FQDN>" but its prompting for credentials which it didnt normally do, I guess it used integrated / pass through credentials.

Anyone any ideas how I can fix this?



  • You could try to change the following line:
    Connect-VIServer ${ip} -WarningAction 0


    Connect-VIServer -Credential ${CREDENTIAL} ${ip} -WarningAction 0

    In this case credentials may provide access to system with adequate permissions to connect.

    You may also want to try playing with –User and –Password arguments.