My Blog List

Wednesday, March 13, 2024

VMWare - PowerCLI

PowerCLI

#Importing the module

Import-Module $env:SMS_ADMIN_UI_PATH.Replace("bin\i386","bin\ConfigurationManager.psd1") -Global

import-module AHToolKit

Import-Module VMware.VimAutomation.Core


#modifies the VMware PowerCLI configuration.

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Set-PowerCLIConfiguration -DefaultVIServerMode multiple -Confirm:$false


#connect to vcenter

Connect-VIServer -Server 172.xxx.xxx.xxx

#List permissions
Get-VIPermission | Select Role, Principal

#Add new user/group(principal) to vcenter admin 
New-VIPermission -Entity xxx01-6.5 -Principal "user/group name" -Role Admin -Propagate:$true

#create a variable
$per = Get-VIPermission -Entity (Get-datacenter) -Principal "BAYSIDEHEALTH\its - serverteam"

#remove permissions

remove-VIPermission -Permission $per


---------------------------------------------------------------------------------------------------------------------------

Reference: https://developer.vmware.com/docs/powercli/latest/products/vmwarevsphereandvsan/commands-index/ 

No comments:

Post a Comment

Steps to extract ntfs share details from file server shares

As part of a file server consolidation effort, I was tasked to come up with a method to move multiple shares on multiple shares to a WSFC. I...