I have written a script to configure the Virtual Fast Cache on an ESX host (just doing one at the moment in my testing) and I am getting the following error when I run the script.
Get-VMHostVFlashConfiguration Permission to perform this operation was denied. Required privilege 'System.Read' on managed object with id 'HostSystem-host-2605'.
I have imported the extensions module with the cmdlets for using the Get-VMHostVFlashConfiguration, so there shouldn't be an issue with using it. My account that I am using has full admin access to the entire vCenter and all objects managed by it.
Here is a sample of my code as well:
Import-Module VMware.VimAutomation.Extensions
$vCenter = "vcenter.host"
$user = "username"
$dsFast1_1 = "naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$dsFast1_2 = "naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$host1 = "esx.host"
$myCreds = Get-VICredentialStoreItem -User $user -Host $vCenter
Connect-VIServer $vCenter -User $myCreds.User -Password $myCreds.Password
$VMhost1 = Get-VMHost $host1
$SSDs = $VMhost1 | Get-VMHostDisk | Where {$_.ScsiLun.CanonicalName -contains $dsFast1_1 -or $_.ScsiLun.CanonicalName -contains $dsFast1_2}
$VMhost1 | Get-VMHostVFlashConfiguration | Set-VMHostVFlashConfiguration -AddDevice $SSDs
Disconnect-VIServer * -Confirm:$false
I am hoping that someone might be able to tell me what the issue is. I don't believe that there is anything wrong with my code.
Cheers
IMMIAnt
don't know the vicredentialstoreitem authentication. i'am connecting normally through an encrypted textfile which i push as input
maybe you could try it with that way? to see if it's a Problem with the Authentication.
Push an Passwort with:
####
$pwd = read-host -assecurestring:$true "Please enter"
$pwd | ConvertFrom-SecureString | Set-Content encrypted.txt
##
then push the script with:
$passwordenc = gc encrypted.txt |convertTo-secureString
$SSTU = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($passwordenc)
$password = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($SSTU)
Import-Module VMware.VimAutomation.Extensions
$vCenter = "vcenter.host"
$dsFast1_1 = "naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$dsFast1_2 = "naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$host1 = "esx.host"
Connect-VIServer $vCenter -User xxxx -Password $password
$VMhost1 = Get-VMHost $host1
$SSDs = $VMhost1 | Get-VMHostDisk | Where {$_.ScsiLun.CanonicalName -contains $dsFast1_1 -or $_.ScsiLun.CanonicalName -contains $dsFast1_2}
$VMhost1 | Get-VMHostVFlashConfiguration | Set-VMHostVFlashConfiguration -AddDevice $SSDs
Disconnect-VIServer * -Confirm:$false
PS: if you like to encrypt both> you could create for user + password own encrypted files for inputing
Hi
Welcome to the communities.
Seems some permission issuse ,please check with root id or connect tnhrough putty
Take care!
Thanks for reponses Madmax01 and ramkrishna1. I should have mentioned that I successfully connect to the vCenter. I have full Administrative permissions to the entire vCenter and all the child objects. I have no issues using the CredStore with my credentials and running any other PowerCLI scripts. The only difference with this script is that I am importing a module that has the cmdlets for virtual flash configuration within vSphere 5.5.
So I don't believe that the issue is with my connection to vCenter or the permissions that I have. Even though I said I think my code is correct, there must be something wrong with it or with the import module.