Skip to content

Instantly share code, notes, and snippets.

@sandeep-sr
sandeep-sr / powercli_capacity_report.ps1
Created June 3, 2021 15:45
powercli - capacity report
#import vmware powershell modules
Get-Module *vm*|import-module
#Connect to vCenter
connect-viserver vcentername.thecloudwiki.com -ea silentlycontinue
#Get the VM details
$vm=(Get-View -ViewType "Virtualmachine" -Filter @{"Runtime.PowerState" ="poweredOn";"Config.GuestFullName"=".*windows*.*"}).name
$percentWarning = 15;
$percentWarning = 15;
$percentCritcal = 10;
$percent50 = 50;
@sandeep-sr
sandeep-sr / powershell_find_ad_disabled_accounts.ps1
Created June 3, 2021 15:48
powershell - find disabled ad user accounts
Import-Module Active*
$userdata=get-content c:\temp\useraccounts.txt
foreach($user in $userdata)
{
try
{
$Disabled=(Get-ADUser -Identity $user).Enabled
if($Disabled -match "False")
{
@sandeep-sr
sandeep-sr / powershell_ip_increase.ps1
Created June 3, 2021 15:49
powershell - simple powershell operators we can increase the last digits in an IP
#Helps in increasing the IP based on the input
$IP="10.1.2.3"
$split=$IP.Split(".",4) | Select -Index 3
[int]$lastpart=$split
$ipnew=($ip.split(".",4)|select -index 0,1,2) -join "."
$add=$lastpart+25
$ip25th=$IPnew +"." +$add
Write-Output "$ip25th"
@sandeep-sr
sandeep-sr / User_To_VM_Mapping.ps1
Created June 19, 2021 17:33
Horizon Cloud DAAS REST API - VM to User mapping PowerShell Script
<#
.Synopsis
VM to User mapping Powershell Script
.Details required to run the script
1) Enter the Portal URL for $tenanturl
2) Enter the Domain Name for $Domain
3) Change the Path of CSV file in $csvfile
4) Enter Credentials information in $ADCredentials section which need below inputs
@sandeep-sr
sandeep-sr / NSX_Host_Prep_Report.ps1
Created July 4, 2021 10:25
find the clusters are not in ready state for NSX-V
<#
.Synopsis
find the clusters are not in ready state
.Note
Copy the vcenter names into a text file named "vcenter" and place it into C:\temp before executing the script
#>
Get-Module -listavailable *vm*|Import-Module
Get-Module -listavailable *nsx*|Import-Module
$cred=Get-Credential
$redColor = "#FF0000"
@sandeep-sr
sandeep-sr / Unassign_all_user_mapings_from_a_specific_pool.ps1
Created July 8, 2021 10:20
Unassign all users from a specific pool
<#
.Synopsis
Unassign all users mappings from a specific pool
.Details required to run the script
1) Enter the Portal URL for $tenanturl
2) Enter Credentials information in $ADCredentials section which need below inputs
3) You will get a prompt to input pool id of the vm's
.Limitations