Tuesday, May 26, 2015

PowerShell Invoke-Command with -computername object/hash/array

Note to Self:

When using Invoke-Command -ComputerName $nodes.ComputerName, write the scriptblock such that the computername is echoed with the result.

Invoke-command -ComputerName $nodes.ComputerName -Credential $mycred -ScriptBlock {"$ENV:ComputerName, $(test-path D:\folder\file)"}


This will ensure you get the answer at the same time as the computername.  All other attemps are problematic, and test-path doesn't automatically trigger the ComputerName field in the returned dataset.



Monday, January 19, 2015

Published on GitHub

We'll despite my lack of activity on the blog, I've been busy.

Not so much IT busy, as personal busy.  Since I last posted here, we've added another family member (bringing our little home occupancy to 4), dealt with complex and frustrating work situations and survived to tell the tales.

I've also discovered github.com and found it to be interesting and perhaps even useful.  As more and more cloud services become available, I like to try them out.  Sometimes it's worthwhile, but mostly it's yet another user account to keep track of in my password manager of choice.

Regardless, I've now completed another version update to my code snippets program written in AutoIT called DLTray.  Since I built the first version in 2007, it's been updated and modified, but over that period of time, I have found it to be an indispensable program, mostly because it does EXACTLY what I built it to do!

I'm trying to get into publishing some of my more useful PowerShell snippets, but, it's hard to pick and choose what might be useful for someone else. The practical reality is so that so much of what I use daily is contrived from other work posted on the web, it feels somewhat redundant to post my own, but that's exactly what I intend to do.

So, as I digest other's work and figure out how to put it to use, I will be posted useful bits of powershell to the other project I have on GitHub.  Funny enough, those postings can be used with DLTray, so, in a way, it's all related.

If you have a need to post repetitive bits of information anywhere (of any kind code, comments, directions, etc, I highly recommend checking out DLTray.  I know it's not perfect, but I can say honestly that it has saved me far more time that I've spent on it, so it's been worth it for me to develop it and continue customizing it for my daily use.

Perhaps as time passes, I can turn this into a code snippet sharing blog that can be used with DLTray over the long run.

If you come across it and find it useful, let me know.  You'll find it a GitHub.com/danlemire.

Enjoy!