Back to Basics PowerCLI Setting Up Profile For Automation – VirtuallyThatGuy

Welcome to VirtuallyThatGuy – This post will be looking at setting up your PowerShell profile and getting you ready for the journey of Automation

 

 

 

## Run this command as admin in powershell​​ 

 

set-executionpolicy​​ remotesigned​​ 

​​ 

## ​​ Create Powershell Profile

 

## run below in admin mode in Powershell

 

Test-Path​​ $profile

New-Item​​ -path​​ $profile​​ -type​​ file​​ –force

 

## edit the profile and add below: ​​ C:\Users\username\Documents\WindowsPowerShell

 

​​ 

### add the following to powershell power-shell profile​​ 

 

Set-ExecutionPolicy​​ RemoteSigned​​ -Confirm:$false

#Add-PSSnapin VMware.VimAutomation.Core

#Install-Module Vmware.VimAutomation.Core -confirm:$false

Import-Module​​ Vmware.VimAutomation.Core

Update-Module​​ VMware.PowerCLI

New-VIProperty​​ -Name​​ ToolsVersion​​ -ObjectType​​ VirtualMachine​​ -ValueFromExtensionProperty​​ Config.tools.ToolsVersion​​ -Force

New-VIProperty​​ -Name​​ ToolsVersionStatus​​ -ObjectType​​ VirtualMachine​​ -ValueFromExtensionProperty​​ Guest.ToolsVersionStatus​​ -Force

New-VIProperty​​ -Name​​ GuestFullName​​ -ObjectType​​ VirtualMachine​​ -ValueFromExtensionProperty​​ ‘Guest.GuestFullName’​​ -Force

New-VIProperty​​ -Name​​ ToolsVersionStatus​​ -ObjectType​​ VirtualMachine​​ -ValueFromExtensionProperty​​ ‘Guest.ToolsVersionStatus’​​ -Force

New-VIProperty​​ -Name​​ ToolsVersion​​ -ObjectType​​ VirtualMachine​​ -ValueFromExtensionProperty​​ ‘Config.tools.ToolsVersion’​​ -Force

 

### Now your profile is all setup ready for automation ​​ 

 

## Run this command as admin in powershell 
set-executionpolicy remotesigned 
 
##  Create Powershell Profile
## run below in admin mode in Powershell

Test-Path $profile
New-Item -path $profile -type file –force

## edit the profile and add below:  C:\Users\username\Documents\WindowsPowerShell

### add the following to powershell power-shell profile 

Set-ExecutionPolicy RemoteSigned -Confirm:$false
#Add-PSSnapin VMware.VimAutomation.Core
#Install-Module Vmware.VimAutomation.Core -confirm:$false
Import-Module Vmware.VimAutomation.Core
Update-Module VMware.PowerCLI
New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine -ValueFromExtensionProperty Config.tools.ToolsVersion -Force
New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine -ValueFromExtensionProperty Guest.ToolsVersionStatus -Force
New-VIProperty -Name GuestFullName -ObjectType VirtualMachine -ValueFromExtensionProperty ‘Guest.GuestFullName’ -Force
New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine -ValueFromExtensionProperty ‘Guest.ToolsVersionStatus’ -Force
New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine -ValueFromExtensionProperty ‘Config.tools.ToolsVersion’ -Force

### Now your profile is all setup ready for automation  


You May Also Like

About the Author: VirtuallyThatGuy

Leave a Reply

Your email address will not be published. Required fields are marked *