Help me in collecting the most common 'gotchas' that a new user of powershell would hit.
feedback
|
closed as not a real question by Chris S♦, MikeyB, Ben Pilbrow, jscott, Iain♦ Aug 11 '11 at 16:41
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. See the FAQ for guidance on how to improve it.
|
This is a good start. http://stackoverflow.com/questions/803521/powershell-pitfalls | ||||
|
feedback
|
|
When dealing with XML that has an item element (like an RSS feed), the name of the element conflicts with the Item indexer property on the XmlNode class e.g.:
One way to work around this is to replace Item with Item2 in the string version of the XML before converting it to [xml], like so:
Also, keep in mind that if you don't need to look at channel directly, you can use the PowerShell XML adapter to access the item element like so:
It seems that it is the output formatter that has the problem with 'Item' XML element names. | |||
feedback
|
|
I think one big pitfall is understanding that everything is moved around in pipes (not unusual) - the difference being the pipe always carries objects, not just a byte stream. For example, the traditional Hello World program in PowerShell is simply:
As that create a string object, and passes it down the pipe - which ultimately gets evaluated (in this case, .toString() is called as it is displayed to the end user). Once that concept has had time to gel, crazy things like this start making sense:
| |||
|
feedback
|
|
Not setting the "execution policy" I always start with Set-executionPolicy "unrestricted" on clean machines. ... and YES - I do understand the security risks... .. KJ | |||||
feedback
|
|
There are some tricks to running command line utilities that were not built with Powershell in mind:
| |||
|
feedback
|