After an upgrade from powercli 6.3. to 6.5.1 some parts of my script to configure an ESXi host have been showing warnings that I haven't seen before.
The iscsi-binding of 2 vmk ports completely broke but I will ask about this in a different subject if I can't fix it that myself.
question: What do I need to change in the syntax to get rid of the warnings?
The first snippit:
Set-PowerCLIConfiguration-InvalidCertificateActionIgnore-DisplayDeprecationWarnings$false-Confirm:$false|out-null
Write-Host"add local user to readonly role"-foregroundcolorgreen
New-VIPermission-Principaltestuser-Role" readonly "-Propagate:$true-Entity$vmhostname|Out-Null
Write-Host"Done"
Write-Host""
The snippit still works but gives this warning:
WARNING: Parameter 'Principal' is obsolete. This parameter no longer accepts multiple values.
WARNING: Parameter 'Entity' is obsolete. This parameter no longer accepts multiple values
Another snippit:
Write-Host"Connect NFS Datastores"-foregroundcolorgreen
foreach ($datastorein (Get-cluster$cluster|Get-Datastore|where {$_.Type -eq"nfs"-and$_.Accessible -eq"true"})){
New-Datastore-vmhost$vmhostname-Nfs-Name$datastore.Name -Path$datastore.RemotePath -NfsHost$datastore.RemoteHost |Out-Null
}
Write-Host"Done"
Write-Host""
The snippit still works but gives this warning:
WARNING: Parameter 'VMHost' is obsolete. This parameter no longer accepts multiple values.
PowerCLI Version
----------------
VMware PowerCLI 6.5 Release 1 build 4624819
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component 6.5 build 4624453
VMware VimAutomation Core PowerCLI Component 6.5 build 4624450
VMWare ImageBuilder PowerCLI Component 6.5 build 4561891
VMWare AutoDeploy PowerCLI Component 6.5 build 4561891
VMware Vds PowerCLI Component 6.5 build 4624695
VMware Cloud PowerCLI Component 6.5 build 4624821
VMware HA PowerCLI Component 6.0 build 4525225
VMware HorizonView PowerCLI Component 7.0.2 build 4596620
VMware Licensing PowerCLI Component 6.5 build 4624822
VMware PCloud PowerCLI Component 6.5 build 4624825
VMware Storage PowerCLI Component 6.5 build 4624820
VMware vROps PowerCLI Component 6.5 build 4624824
VMware vSphere Update Manager PowerCLI 6.5 build 4540462
Powercli config:
![]()
Powercli helptext:
NAME
New-Datastore
SYNOPSIS
This cmdlet creates a new datastore.
-------------- Example 1 --------------
C:\PS>New-Datastore -VMHost $vmhost -Name Datastore -Path $scsiLun.CanonicalName -Vmfs -FileSystemVersion 3
Creates a VMFS datastore by specifying the file system type.
-------------- Example 2 --------------
C:\PS>New-Datastore -Nfs -VMHost 10.23.112.60 -Name NFSDatastore -Path /mynfs -NfsHost 10.23.84.73
NAME
New-VIPermission
SYNOPSIS
This cmdlet creates new permissions on the specified inventory objects for the provided users and groups in the role.
-------------- Example 1 --------------
C:\PS>New-VIRole -Name Role -Server $server -Privilege (Get-VIPrivilege -PrivilegeGroup)
$permission = New-VIPermission -Role Role -Principal Administrator -Entity (Get-Datacenter)
Creates a permission on the provided server for a role with the specified privileges.