Changing Shared Folders’ Path

As usual, the ideas for the posts start as a question from a colleague or a customer. In this case, the customer had to distribute differently the folders in his FileServers’ volumes. He had added an additional drive, copied all the relevant folders, and now needed to change the shares (non cluster resources) settings. If…

6

Get-ADUser : One or more properties are invalid. Parameter name: msDS-AssignedAuthNPolicy

If you are running PowerShell 4.0 on Windows 8.1/2012 R2 and tried to use the Get-ADUser or Get-ADComputer cmdlets (from the ActiveDirectory Module) with the -Property parameter, specifying * to get all the properties’ object, you may have encountered the error message below: Get-ADUser : One or more properties are invalid. Parameter name: msDS-AssignedAuthNPolicy At…

2

PowerShell’s format operator

I just came across a tip at the Hey, Scripting Guy! Blog about grouping numbers and controlling the decimal places after the dot, that describes the use of the ToString method of the number (int) object. Since I prefer using PowerShell’s -f format operator for that, and it’s description in the PowerShell help topics (Get-Help…

3

Get and Set the machineKeys in machine.config

In an ASP.NET web application, if you use ViewState, Session, Forms authentication, or other encrypted and/or secured values, these values are encrypted and decrypted using a set of keys called decryptionKey and validationKey located in the machineKey element under the system.web section in the .NET’s machine.config file. Normally, these keys are automatically generated every time…

0

Get and Set the compilation debug flag in web.config

Since the main technology I support as a PFE is IIS, I often find myself writing scripts for IIS or ASP.NET management. For example, one of the first things I check when troubleshooting ASP.NET applications is the debug flag in the web.config. For this, I’ve written the following two example functions that use the accelerator…

2

PowerShell scripting best practices

For the past few years, I’ve picked up a several best practices for PowerShell scripting. Some of them are “borrowed” from Ed Wilson (aka the Microsoft Scripting Guy), Don Jones, and other PowerShell MVPs and PFEs @ Microsoft. Start your scripts with a standard set of comments (name, date, author, purpose and keywords) to easily…

4

Dynamic ValidateSet in a Dynamic Parameter

A colleague of mine needed a way to have a parameter accept only a specific set of paths. I told him this can be accomplished easily with the ValidateSet decoration on the parameter, but he then explained that what the actually needed, is to have the set dynamically defined by the sub folders in the…

14

Get Excel data without Excel

In a specific scenario, I needed to be able to query an Excel file and get data from a worksheet but I didn’t (and couldn’t) have the Office suite (or even Excel only) installed on the machine. If the Excel file is and xlsx file (the new Microsoft Open XML Format since Excel 2007), you…

11

Set the Windows 7 user account picture

Not too long ago, I was asked if it's possible and how to set the Windows 7 user account picture (the one you see in the Start menu, and in the Lock screen) using PowerShell.There is no official documented way of doing it, but it can be accomplished quite easily using the SetUserTile static function…

6

Free PowerShell eBooks

last update: 2014/11/28 This (frequently updated) post contains links to useful and free PowerShell eBooks. If you have a suggestion for an eBook to be added to the list, please add a comment at the bottom of this post. The Altaro PowerShell Hyper-V Cookbook:http://www.altaro.com/assets/Altaro-PowerShell-Hyper-V-Cookbook.pdf Active Directory PowerShell Quick Reference:http://www.jonathanmedd.net/wp-content/uploads/2009/10/ADPowerShell_QuickReference.pdf WMI query language (WQL) via PowerShell:http://www.ravichaganti.com/blog/wp-content/plugins/download-monitor/download.php?id=25…

10