Category: Schdraggl

Progress On ‘Invoke-Remote’

Yup, it’s been a while since I had time to work on my little side-project “Invoke-Remote” – it’s a small collection of scripts that aims to enhance my everyday workflow with remote Windows environments.
Today I finally managed to add a missing piece: Get-RemoteFileContent.ps1 (ir-get for the lazy)
This script utilizes IO.FileSystemWatcher in order to make it possible to WAIT until a file is being created on a remote host! 🙂
(comes in handy when waiting for a certain log, lock or sync file)

param($folder, $file)
$fullpath = Join-Path $folder $file
if (-Not (Test-Path $fullpath)) {
  $fsw = New-Object IO.FileSystemWatcher $folder, $file -Property @{IncludeSubdirectories = $false; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'};
  $j = Register-ObjectEvent $fsw Created -SourceIdentifier FileCreated -Action {
while ($env:RF_FILE_CREATED_INDICATOR -eq $false) {
  Start-Sleep -Milliseconds 1000;
  $j = $fsw.Dispose();
  $j = Unregister-Event FileCreated
Get-Content $fullpath


my pre-holiday Schdraggel #1

I’ve just been looking on what to do and where to go this summer on the Azores … and it seems that 18 days on the islands won’t be enough to visit all the awesome places on this atlantic archipel! 🙁