A "which command" cmdlet script
/PS C:\> (get-item env:path).value.split("") | where { $_ -ne "" } | where { test-path( join-path $_ "msbuild.exe" ) }
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
Next task, make it a parameterized cmdlet
Code zealot in a connected world
PS C:\> (get-item env:path).value.split("") | where { $_ -ne "" } | where { test-path( join-path $_ "msbuild.exe" ) }
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
Next task, make it a parameterized cmdlet
Many companies now have Wiki's. A lot of wiki's can do with a nice clean-up bot to do maintenance. So the plan is this:
Write a wiki bot.
Thoughts:
Nooooo they look so pretty.
I need to get another Dell Inspiron soon.
Last year I bought a DELL inspiron laptop, I had some initial problem with its LCD, but once I could convince the girl on the support line that there REALLY is a problem, and have them send a technician out to me, it was replaced quite quickly (and noisily - the whole office came around to see what's the screwing noise).
The repair tech told me that he's familiar with the issue and he's done a few similar repairs already (I wish the call centre could be a bit in touch with known problems with their hardware).
Anyway, ever since it was repaired I've had ZERO issues with my DELL (and I program, play WoW pretty much everyday on the thing). I love it and I'm definitely going to get a DELL again. (In fact I recommended my brother to get a DELL laptop last year and he did).
Now the choice of getting the perfect DELL laptop just got harder. 8 colours. Damn...
Update
I wish it'd be easier to blog something about DELL. Hello Dell are you listening?
Where's the DIGG/BLOG this button?
May be it's over in the Direct2Dell area
I was a bit shocked at how "difficult" it was to find how to create a cmdlet script. After all, it was pretty basic to write a cmd (or bat) file and just run it.
Anyway, here's the trick.
rename the file "myscript.ps1" (yes, that's right, .ps1 suffix, not .ps, nor .ps2, and 3 is two too far, 4 would be way out. .ps1 it shall be).
I'm sure there's a story for this suffix, it would be nice to hear it.
Next, you need to sign your script so PS will allow it to run. This is covered in numerous places, including the docs that came PS.
Update:
set-executionpolicy remotesigned
Will usually give you what you need - unchecked local execution but remote scripts (such as a remote-admin) must be signed.
get-help set-executionpolicy
get-help about_signing
# filter directories, look for cs files.
$files = get-chilitem . -include *.cs -recurse
$regex = new-object -type System.Text.RegularExpressions.Regex "pattern"
foreach($file in $files){
$content = get-content $file
# run regexif (regex.IsMatch(content)) {
#write-out
$file}
}
#sorry for the lack of spacing - I'm typing code in a blog editor and pressing spaces is too much work
I look at how a small team can build amazing things with the latest tools we have in Office 365 & SharePoint. I'm a coder, developer, Office SharePoint MVP. I dream, then I rant.
Founder @ Flow Studio App
A poweruser tool to help every maker write better Microsoft Flows and manage them.
MVP Alumni Office Apps and Services: SharePoint
MVP Alumni Business Applications: Flow
This work by John Liu is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Permissions beyond the scope of this license may be available at /about-me/.