Skip to content

Instantly share code, notes, and snippets.

View vScripter's full-sized avatar
👨‍💻

Kevin Kirkpatrick vScripter

👨‍💻
View GitHub Profile
PROCESS {
if (Test-Path -LiteralPath $filePath -PathType Leaf) {
Get-Content -LiteralPath $filePath -ReadCount 0
} else {
Write-Warning -Message 'Work Log file has not been created'
function Get-WorkLog {
[cmdletbinding()]
param (
[parameter(Mandatory = $false)]
[System.String]$Path = "$ENV:USERPROFILE\Documents\GitHub\WorkLog"
)
PROCESS {
if (Test-Path -LiteralPath $filePath) {
if ($Indent) {
$indentMessage = $(Add-Indent -Level $Indent) + $Message
Write-Verbose -Message 'Adding message to Work Log'
Write-Output -InputObject $indentMessage | Out-File $filePath -Append
BEGIN {
$now = Get-Date
$dateFormat = $now.tostring('yyyyMMdd')
$dateDay = $now.tostring('dddd')
$fileName = $dateFormat + '_' + $dateDay + '_' + 'WL.md'
$filePath = Join-Path $Path $fileName
$nowLong = $now.tostring('D')
function Add-Indent {
function Add-WorkLog {
[cmdletbinding()]
param (
[parameter(Mandatory = $true,
Position = 0)]
[System.String]$Message,
[parameter(Mandatory = $false,
Position = 1)]
PROCESS {
if (-not (Test-Path -LiteralPath $filePath -PathType Leaf)) {
try {
Write-Verbose -Message 'Creating worklog file'
New-Item -Path $filePath -Type File -ErrorAction 'Stop' | Out-Null
Write-Verbose -Message 'Adding message to Work Log'
BEGIN {
$now = Get-Date
$dateFormat = $now.tostring('yyyyMMdd')
$dateDay = $now.tostring('dddd')
$fileName = $dateFormat + '_' + $dateDay + '_' + 'WL.md'
$filePath = Join-Path $Path $fileName
$nowLong = $now.tostring('D')
} # end BEGIN block
function New-WorkLog {
[cmdletbinding()]
param (
[parameter(Mandatory = $false)]
[System.String]$Path = "$ENV:USERPROFILE\Documents\GitHub\WorkLog"
)
# created: 2013-01-28
$params = {
VMHost = 'esxi01.devlab.local'
BackupConfiguration = $true
DestinationPath = 'c:\hostconfigs\esxi01'
}
Get-VMHostFirmware @params

Keybase proof

I hereby claim:

To claim this, I am signing this object: