You have to love RegExp! ;)

Second part of scripting games is out there and I’m still working with the first one. Well… I’m busy man after all, right? 😉 I re-written whole script, mainly because I realized it will be impossible to use PSDrives in remote scenario, and I would really love to do “advance” version. Not that I’m all that advanced… It simply a matter of ambitions. 😉

Today I’ve read Don Jones post on his “PowerShell with purpose” Blog and I decided to go this route (script cmdlet looks so COOL! 😉

I’ve also wanted to add some logic to test registry path that user would provide and found out that besides “ValidateSet”, there is also “ValidatePattern” there waiting for me to grab it and do some cool stuff with it. But, to be honest, error message is not really obvious I’m afraid…:

D:ScriptsPowerShellUpdate-RemoteRegistry.ps1 : Cannot validate argument on parameter 'RegistryKey'. 
The argument "HKLM:Software*ScriptingGuys2010ScriptingGames" does not match the "^HK(LM|CU):\[^*?:<>|]+$" pattern. 
Supply an argument that matches "^HK(LM|CU):\[^*?:<>|]+$" and try the command again.
But it’s so ‘geeky’ that I can hardly resist it. And, after all, it won’t be ‘normal user’ who will use this cmdlet, right?
Anyway, I’m back where I assumed I was when writing previous post. I only hope that this time I’m not too optimistic and I really have to do only “ACL” part of the script… And with the .NET class it shouldn’t be that hard. I hope. 😉


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s