This past Tuesday I had the pleasure of presenting our TechNet Event in downtown Chicago. WOW! We had a great turnout, and a very fun discussion around Windows Vista, Windows PowerShell, and the latest improvements in Group Policy.
During the day, and as always, there were some questions asked for which I wasn’t sure of the answer.
Yeah, I know.. hard to believe. (sigh) And as promised, I’ve done some research and found some answers for you, as well as additional resources around those topics.
But before I go into those; I also want to make sure I get that PowerShell demo script into your hands. I’ve attached it to this blog post, as well as attached it to the online version of my TechNet Resources document for these sessions. I want you to be able to use it as just one more useful tool to help you get comfortable with PowerShell.
Okay.. so here are those questions. And now some answers, too.
“SMB 2.0. What’s up with that?!”
(Okay.. these questions aren’t actual quotes. Allow me to paraphrase just a little bit.)
In our discussion of Windows Vista improvements, we were discussing the subject of file transfer improvements. While most scenarios did improve, many people experienced lousy performance initially. Those scenarios have been addressed in later updates, and now in Windows Vista SP1 as well. However, one gentleman did mention that he was still having those issues.. and another mentioned that uninstalling SMB 2.0 on his Server 2008 actually got rid of the problem. So the question really was, “Why? Is that a known problem? Is there a solution other than disabling SMB 2?”
I wasn’t able to get any information on whether there are still any known issues, so I can’t address why you were having problems. But I did find some good resources that list improvements; and particularly list some of the types of issues that people were experiencing prior to SP1.
In particular, Mark Russinovich’s blog post here does a good job of spelling it out in great detail.
Also, for a good discussion on network performance improvements, see this Tolly Group Report that reports their test results of Windows Server 2008 and Windows Vista compared to earlier Windows versions.
“Can I use Windows PowerShell to generate reports from or work with Internet Logs? Or what about browsing history or cookies?”
Text file processing is definitely doable in Windows PowerShell. I haven’t mastered it myself (yet), but here are some articles (3 parts) that were based on Chapter 10 of the book by Bruce Payette book, “PowerShell in Action”.
- Part 1 – Processing Unstructured Text
- Part 2 – File Processing in PowerShell
- Part 3 – XML Processing in PowerShell
Processing input and output of text is one of the biggest advantages PowerShell has over VBScripting… so much of the heavy lifting is done for you in PowerShell.
“Where can I find some resources specifically around working with WMI in PowerShell?”
The aforementioned book also has a section in chapter 12 on it.
During the TechNet Event , you’ll recall that we used the Get-WMIObject command to get instances of WMI objects based on the class we want to work with. Example – getting an object representing the local desktop looks like this:
Get-WmiObject -Class Win32_Desktop -ComputerName .
For a list of the classes, you can look at the WMI Reference on MSDN. And you can get a list of the WMI Classes available to you in PowerShell with this command:
or for a list of the classes in the “rootcimv2” namespace:
Get-WMIObject –namespace “rootcimv2” -list
“What about scripts that do something administrative, and in the context of another user account/password. Can I encrypt the script, or those sensitive values within the script?”
I don’t know of a way to encrypt the script entirely, or even encrypt text within. There are security features in PowerShell that can allow you to maintain encryptions of strings in memory (SecureString .NET class) or prompt you for credentials (Get-Credential cmdlet). Those would both be useful for creating scripts that prompt for and then secure the information that is being used. But prompting you is not something you want if you’re interested in launching this script on a schedule or as a task that is triggered in some way – which I think is really is what was being asked for.
Instead – consider that in Task Scheduler you do have the ability to launch tasks in the context of a specific account. So what I would recommend is that you do it that way. Make sure that the script is running already in the context of the account that has the proper rights for the job at hand.
“What PowerShell books do you recommend?”
I don’t personally have any recommendations. I have and have made good use of the Bruce Payette book for the answers here, but really there are dozens of good books out there; easy to find if you do a search for them.