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.