§ April 30, 2013 09:17 by
beefarino |
Tomorrow evening I’ll be giving an online presentation to the Arizona PowerShell User Group. I’ve heard great things about this group and am really looking forward to the talk – if you want to join the fun check out the details here: http://www.azposh.com/2013/04/maymeeting/.
The topic is “Strange Things with PowerShell”. Well, that’s the title – the topic is really a set of skunkwork projects I’ve been hammering out since the beginning of the year. I’ll introduce them briefly in this post, but if you want to learn more you’ll have to tune in tomorrow evening or wait for the release.
The first project I’ll be covering is the Entity Shell (ES). ES is a PowerShell module that “knows” all about Microsoft’s ORM named Entity Framework. Basically, once you have an Entity Framework data context defined, you can use PowerShell to manage your entities without doing any extra work. Here’s a working code snippet to whet your appetite:
# pull in the entity shell
import-module entityshell;
# pull in my entity data context
new-psdrive -name ent -root '' -psp entityprovider `
-context [SuperAwesomeWebsite.Models.Context]
# create a set of 100 new user accounts for testing
0..99 | new-item -path ent:/users -username { "User$_" } -password { "Password$_" }
# commit the new entities to persistent storage
complete-unitOfWork
# server-side filter for users without a password
$u = dir ent:/users -filter "it.Password IS NULL"
# generate a report of these users
$u | convertto-csv | out-file "badusers.csv"
# remove the offending users
$u | remove-item
# commit these removals to persistent storage
complete-unitOfWork
The other project I’ll be demoing is Polaris; this project came about as a way to see how simple I could make the process of extending Windows Explorer. Shell namespace extensions are hard; Polaris makes it dirt simple, and all you need is a little PowerShell to turn Windows Explorer into a rich dashboard of the stuff you want to see.
More on these projects in the coming weeks; in the meantime, if you want to see the goods, you’ll have to tune in (http://www.azposh.com/2013/04/maymeeting/).