Skip to content

Instantly share code, notes, and snippets.

View Unassign_all_user_mapings_from_a_specific_pool.ps1
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
sandeep-sr / NSX_Host_Prep_Report.ps1
Created Jul 4, 2021
find the clusters are not in ready state for NSX-V
View NSX_Host_Prep_Report.ps1
find the clusters are not in ready state
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
$redColor = "#FF0000"
sandeep-sr / User_To_VM_Mapping.ps1
Created Jun 19, 2021
Horizon Cloud DAAS REST API - VM to User mapping PowerShell Script
View User_To_VM_Mapping.ps1
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 / powershell_ip_increase.ps1
Created Jun 3, 2021
powershell - simple powershell operators we can increase the last digits in an IP
View powershell_ip_increase.ps1
#Helps in increasing the IP based on the input
$split=$IP.Split(".",4) | Select -Index 3
$ipnew=($ip.split(".",4)|select -index 0,1,2) -join "."
$ip25th=$IPnew +"." +$add
Write-Output "$ip25th"
sandeep-sr / powershell_find_ad_disabled_accounts.ps1
Created Jun 3, 2021
powershell - find disabled ad user accounts
View powershell_find_ad_disabled_accounts.ps1
Import-Module Active*
$userdata=get-content c:\temp\useraccounts.txt
foreach($user in $userdata)
$Disabled=(Get-ADUser -Identity $user).Enabled
if($Disabled -match "False")
View powercli_capacity_report.ps1
#import vmware powershell modules
Get-Module *vm*|import-module
#Connect to vCenter
connect-viserver -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 / powershell_clear_temp_files.ps1
Last active Jun 3, 2021
powershell - useful script to clear temporary files before start patching the windows servers to make some space
View powershell_clear_temp_files.ps1
#This script can be used to to clear un used space of C:\ in windows servers
#once the task is completed it will send a mail to the added in $msg.To.Add
#please update your own smtp server address
#enter the servers suppose to release un-used space in 123.txt file (ex--c:\temp\123.txt)
#Create a folder named Cleanupreports in C:\temp
#Script assumes delprof is already installd in all the servers
$Path = "C:\temp\Cleanupreports\"
sandeep-sr / powershell_sccm_server_status.ps1
Created Jun 3, 2021
powershell - SCCM Check for Server online/offline, Servers presents in AD or not, Service status, Site Code and SCCM client installed or not
View powershell_sccm_server_status.ps1
$servers=get-content "C:\temp\SCCM\servers.txt"
$Name = "SCCM_Serv.html"
$report = "C:\temp\SCCM\" + $Name
$header = "
sandeep-sr / powershell_SCCM_client_status_version.ps1
Created Jun 3, 2021
powershell - script to check SCCM client status,version & sitecode
View powershell_SCCM_client_status_version.ps1
This script will check SCCM client status,version & sitecode.
If the site code is not cloudwiki1 it will assign/change to cloudwiki1
Start-Transcript c:\temp\versionlog.txt
sandeep-sr / powercli_delete_multiple_vms.ps1
Created Jun 3, 2021
powercli - Delete multiple VM’s
View powercli_delete_multiple_vms.ps1
Get-Module -ListAvailable *vm*|Import-Module
Connect-VIServer vcenter02 -Credential $cred
$deletevmlist=Get-Content C:\temp\delete.txt
foreach($deletevm in $deletevmlist)
write-output ("$deletevm is deleting...")
get-cluster cluster02|get-vm $deletevm |Remove-VM -DeletePermanently -Confirm:$false -RunAsync| out-null
Start-Sleep 10