Skip to content

Instantly share code, notes, and snippets.

@manualbashing
manualbashing / esxi_logs.md
Last active November 6, 2019 12:30
[Troubleshooting log files] for #ESXi and #vCenter

ESXi Host Logs

Component Location ESXi Host LogsPurpose
1. VMkernel /var/log/vmkernel.log ESXi
2. VMkernel warnings /var/log/vmkwarning.log Records activities related to virtual machines
3. VMkernel summary /var/log/vmksummary.log Used to determine uptime and availability statistics for ESXi (comma separated)
4. ESXi host agent log /var/log/hostd.log Contains information about the agent that manages and
@manualbashing
manualbashing / download_latest.ps1
Last active October 30, 2019 12:17
Download latest Release from github
$gitHubUrl = 'https://github.com/portapps/mremoteng-portable/releases/latest'
$assetName = "mremoteng-portable-win32-*.7z"
$gitHubApi = $gitHubUrl -replace '^https://github.com/', 'https://api.github.com/repos/'
$response = Invoke-WebRequest -Uri $gitHubApi -UseBasicParsing
$json = $response.Content | ConvertFrom-Json
$release = $json.assets | Where-Object Name -like $assetName
Invoke-WebRequest $release.browser_download_url -OutFile ".\$($release.name)"
@manualbashing
manualbashing / clone_with_pat.sh
Created October 30, 2019 14:58
Clone #AzureDevOps repository with PAT
git clone https://<PAT>@dev.azure.com/<yourOrgName>/<yourProjectName>/_git/<yourRepoName>
@manualbashing
manualbashing / which_distribution.md
Last active November 6, 2019 12:29
Find out, which #Linux distribution you are running

This method gives the most appropriate answer on older Linux Distributions:

cat /etc/issue

This method works best on modern Linux distributions:

@manualbashing
manualbashing / installing_software.md
Created October 30, 2019 15:03
Installing Software on #Linux systems

Ubuntu

sudo apt-get install <package>

CentOS

@manualbashing
manualbashing / setup_local_environment_windows.md
Last active October 31, 2019 09:58
Blogging with Jekyll and Github pages
$jekyll = 'docker run -it --rm --volume=C:\Users\m.batsching\git\manualbashing\:/srv/jekyll --volume=cache:/usr/local/bundle -p 4000:4000 jekyll/jekyll jekyll'

# Get the jekyll version
iex "$jekyll --version" | Select-Object -Last 1

# Create a new blog
iex "$jekyll new . --force"
@manualbashing
manualbashing / Invoke-Elevated.ps1
Last active November 6, 2019 15:34
[Invoke Elevated Command] Hacky but fun way to run individual #PowerShell commands in a temporary, elevated session... Like sudo
function Invoke-Elevated
{
[Alias('sudo')]
[CmdletBinding()]
param(
[switch]
$NoExit,
[parameter(ValueFromRemainingArguments=$True)]
[object[]]
@manualbashing
manualbashing / coding_guidelines.md
Created November 6, 2019 12:32
[Coding Guidelines] for #PowerShell

Using Strings

  • Use single quotes, unless you are using variables in a string.

Output

  • Always prefer Write-Verbose and Write-Error over Write-Host
  • Always prefer PSObjects over Strings
@manualbashing
manualbashing / export_worksheet.ps1
Created November 6, 2019 14:28
Copy all worksheets from excel file as csv
$xls = New-Object -ComObject excel.application
$xls.Visible = $false
$xls.DisplayAlerts = $false
$wb = $xls.Workbooks.Open("$pwd\anforderungen.xlsx")
$wb.Worksheets | ForEach-Object { $_.SaveAs("$pwd\" + $_.Name + '.csv',6) }
$xls.Quit()
@manualbashing
manualbashing / unicode.ps1
Created November 6, 2019 14:35
Disply unicode characters in #Git commit log messages when using #PowerShell
# Put this into the user profile
$env:LC_ALL = 'C.UTF-8'