Skip to content

Instantly share code, notes, and snippets.

@MichaelRyom
MichaelRyom / Set-VMDK-Geometry.ps1
Created April 8, 2016 14:02
Change VMDK geometry
$Path = "C:\Users\Michaelryom\Downloads\VMware\vRealize-Operations-Manager-Appliance-6.1.0.3038036_OVF10\"
$vdisk = 'C:\Program Files (x86)\VMware\VMware Workstation\vmware-vdiskmanager.exe'
$VMDKs = dir $Path*.vmdk
cd $path
Foreach($VMDK in $VMDKs){
$OldVMDK = $VMDK.Name
$NewVMDK = $VMDK.Name -replace(".vmdk","-NEW.vmdk")
$TempVMDK = $VMDK.Name -replace(".vmdk","-TEMP.vmdk")
#Variables
$username = "admin"
$password = "Password"
$vRopsFQDN = "vRops"
#vRops SSL certificate trust
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
@MichaelRyom
MichaelRyom / Uninstalling a vRops Management Pack
Created June 8, 2016 18:08
Uninstalling a vRops Management Pack
cat /storage/db/pakRepoLocal/[MGMT PACK]/manifest.txt
cd /usr/lib/vmware-vcops/tools/opscli/
./ops-cli.sh solution uninstall ”Management Pack for Storage Devices”
@MichaelRyom
MichaelRyom / Set-NSXControllerSyslog.ps1
Last active June 12, 2016 10:35
This script six inputs which are used to setup NSX Controller syslog option, which has to be done via API calls
Param(
[string]$username,
[string]$NSXFQDN,
[string]$SyslogServer,
[string]$SyslogPort,
[string]$SyslogProtocol,
[string]$SyslogLevel
)
$Secpw = Read-Host -AsSecureString -Prompt "Password"
#^End of variables
Get-VMHost | Get-VMHostNetwork | Select HostName,`
@{Name="vmk0";Expression={($_.VirtualNic | where {$_.Name -eq "vmk0"}).mac}},`
@{Name="vmk1";Expression={($_.VirtualNic | where {$_.Name -eq "vmk1"}).mac}},`
@{Name="vmnic0";Expression={($_.PhysicalNic | where {$_.Name -eq "vmnic0"}).mac}},`
@{Name="vmnic1";Expression={($_.PhysicalNic | where {$_.Name -eq "vmnic1"}).mac}}`
| Export-Csv c:\temp\Mac_Address_List.csv
{
"name":"Custom vRops Content Pack",
"namespace":"MichaelRyom.dk",
"contentPackId":"MichaelRyom.dk",
"framework":"#9c4",
"version":"2.4",
"extractedFields":[ {
"displayName":"MichaelRyom_vRops_API_Call",
"preContext":" \\- ",
"postContext":" elapsed time in ms: ",
$usernameHost = Read-Host -Prompt 'Host Username'
$secPwHost = Read-Host -Prompt 'Host Password' -AsSecureString
$credHost = New-Object PSCredential -ArgumentList $usernameHost,$secPwHost
$VMHosts = "Host01","Host02","Host03"
foreach($Vmhost in $Vmhosts){
Connect-VIServer $Vmhost -Credential $credHost
$esxcli = Get-EsxCli $VMHost
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Agent config API
PUT /api/v1/agent/config controllers.agents.AgentConfigController.set()
GET /api/v1/agent/config/:agentId controllers.agents.AgentConfigController.get(agentId :String, hash :String ?= "")
# Agent status API
PUT /api/v1/agent/status/:agentId controllers.agents.AgentStatusController.set(agentId :String)
#Source: https://michaelryom.dk/auto-create-nano-server-for-esxi-with-powershell
#Created by Michael Ryom @MichaelRyom.dk
#Https://MichaelRyom.dk
#Go to https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-technical-preview and download Windows Server TP 5 - Nano ISO
#Link that might work ? http://care.dlservice.microsoft.com/dl/download/B/3/3/B33F3810-EE82-4C20-B864-394A2C4B6661/Nano-WindowsServerTechnicalPreview5.vhd
#Windows Server TP5 Licnese Key MFY9F-XBN2F-TYFMP-CCV49-RMYVH
#Download image if link works: wget http://care.dlservice.microsoft.com/dl/download/B/3/3/B33F3810-EE82-4C20-B864-394A2C4B6661/Nano-WindowsServerTechnicalPreview5.vhd -OutFile C:\temp\Windows-Nano-Server-TP5.VHD
#http://care.dlservice.microsoft.com/dl/download/8/9/2/89284B3B-BA51-49C8-90F8-59C0A58D0E70/14300.1000.160324-1723.RS1_RELEASE_SVC_SERVER_OEMRET_X64FRE_EN-US.ISO
#Variables that can be chnaged
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Agent config API
PUT /api/v1/agent/config controllers.agents.AgentConfigController.set()
GET /api/v1/agent/config/:agentId controllers.agents.AgentConfigController.get(agentId :String, hash :String ?= "")
# Agent status API
PUT /api/v1/agent/status/:agentId controllers.agents.AgentStatusController.set(agentId :String)