This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import getpass | |
| import json | |
| import os | |
| from argparse import ArgumentParser | |
| from jinja2 import Environment, FileSystemLoader | |
| from vraapiclient import reservation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //input: userEmail [String] | |
| //input: cluster [VC:ClusterComputeResource | |
| var csv = "" | |
| var hosts = cluster.host | |
| // Setup Mail Client | |
| var message = new EmailMessage(); | |
| message.smtpHost = "smtp@org.co.uk"; | |
| message.fromName = "vCenter Orchestrator"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //input: userEmail [String] | |
| //input: vmHost [VC:Host] | |
| var csv = "" | |
| // Setup Mail Client | |
| var message = new EmailMessage(); | |
| message.smtpHost = "smtp-host@org.co.uk"; | |
| message.fromName = "vCenter Orchestrator"; | |
| message.fromAddress = "noreply@org.co.uk"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" | |
| $headers.Add("Accept", "application/json") | |
| $headers.Add("Content-Type", "application/json") | |
| $url = "whatever.com" | |
| $r = Invoke-RestMethod $url -Headers $headers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Inputs: | |
| //host: vCACCAFE:vCACHost | |
| //user: string | |
| //Can get host like this if needed: | |
| //var host = vCACCAFEEntitiesFinder.getHost("id-of-host-yes"); | |
| var catalogClient = host.createCatalogClient(); | |
| var catalogConsumerResourceService = catalogClient.getCatalogConsumerResourceService(); | |
| var filter = new Array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Version] | |
| Signature="$Windows NT$" | |
| [NewRequest] | |
| Subject = "CN=servername.corp.com, OU=, O=, L=, S=, C=" | |
| Exportable = TRUE | |
| KeyLength = 2048 | |
| KeySpec = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Needed to search for invalid hostname inside lots of config files | |
| $wrongHost = "the-host.com" | |
| $path = "D:\Program Files (x86)\VMware\vCAC\" | |
| Get-ChildItem -Path $path -Filter *.config -Recurse | ? { !$_.PSIsContainer } | % { | |
| $f = Get-Content $_.FullName | |
| $c = $f | % { $_ -match $wrongHost } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Add BackConnectionHostNames | |
| #You can use 'r for carriage return as this is a MultiLine String key | |
| $hosts ="iaas-web.corp.local`r`niaas-mgr.corp.local`r`niaas-web-01.corp.local`r`niaas-web-02.corp.local" | |
| Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\LSA\MSV1_0 -Type MultiString -Name BackConnectionHostNames -Value $hosts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Clean-Logs { | |
| <# | |
| .SYNOPSIS | |
| Remove files oder than x days from x location | |
| .DESCRIPTION | |
| Mainly used to remove IIS logs that are older than a certain number of days. | |
| .EXAMPLE | |
| Clean-Logs -Retention 7 -Directory D:\Logs | |
| .PARAMETER Retention | |
| Number of days to retain logs. Specifying 7 will remove logs older than 7 days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Run - Get-Cluster CLUSTERNAME | Get-VM | Select Name | Sort Name | Export-Csv ./CLUSTERNAME.csv -NoTypeInformation | |
| $clusterVMs = Import-Csv '.\ASMCL06.csv' | |
| $KB = "KB2982791" | |
| $KBNumber = $KB.Replace("KB", "") | |
| $RemovalCommand = "wusa.exe /uninstall /kb:$KBNumber /quiet /norestart" | |
| $Domain = "corp.local" | |
| $report = @() | |
| $clusterVMs | % { |