Windows 7 Libraries
Hello everyone, I am new to Powershell and would appreciate some help. Currently I am trying to manipulate Windows 7 libraries using Powershell. I would like to be able to perform basic tasks like...
View ArticleReply To: Windows 7 Libraries
I found this interesting so I went poking around figuring there had to be some .NET-ish methods to get to it. Researching I was able to find this on StackExchange:...
View ArticleReply To: Is there a better way to expand a calculated field?
Is this any faster: [string](gwmi win32_logicaldisk ) -split '\\\\.+?DeviceID="' -replace ':"'
View ArticleReply To: Is there a better way to expand a calculated field?
Even if it is faster, it would be bad habit to go back to text parsing like that. PowerShell’s biggest strength is the ability to work with objects, not text. For example, run it this way, and you’ll...
View ArticleReply To: Is there a better way to expand a calculated field?
I agree that doing text parsing is not something you want to do as a matter of course, but when a solution needs to scale to millions of operations I think purity can be put aside in favor of...
View ArticleReply To: Is there a better way to expand a calculated field?
The better question is what are you trying to achieve with your script and what is the best way to reach that goal. I would always recommend outputting objects as the first option BUT there are times...
View ArticleReply To: Is there a better way to expand a calculated field?
In this instance I was not necessarily trying to achieve any real-world result. I appreciate the replies. I learned a few approaches that I had never considered before.
View ArticleReply To: Setting up DSC on Win2008R2 Server Can't find DSC-Service Feature
Dave, Many thanks for that. Worked a treat. Once I got to the end of the instructions, the call to the svc page worked just as expected. Thank you very much for finding the bit I missed. I guess it’s...
View Articletwo issues I noticed in get-alias
I found two issues with get-alias. Maybe I’m doing something wrong. First one is that the alias of cmdlets are not found. If I type get-alias ls, the appropriate cmdlet is printed out. If I type...
View ArticleReply To: two issues I noticed in get-alias
You’re doing something wrong :). First, LS is an alias. Get-Children isn’t an alias. “Get-ChildItem” is a command name; it won’t show up from Get-Alias because it isn’t an alias. It’s the real command...
View ArticleReply To: Runs fine in the ISE but not when ran as a script?
Well Done Martin! your advise was correct and now the script runs! I was using the continue the wrong way Thank you
View ArticleReply To: two issues I noticed in get-alias
ok, thanks. I still don’t understand however, why where-object doesn’t read the entire contents of the “name” object. for example dir -> Get-ChildItem is the output of name, right? so why does...
View ArticleReply To: two issues I noticed in get-alias
You’re not following the logic. First, it’s Get-ChildItem, not “get-children.” That’s important. Get-Alias dir Returns output because there is an alias, Dir. That output is an object, and it has a...
View ArticleReply To: Windows 7 Libraries
Thanks a lot for your input Raymond, it is much appreciated. I was researching the ISHelllibrary on the MSDN link you provided and that seems to have all I need. However the code they have is C++...
View ArticleReply To: Is there a better way to expand a calculated field?
I’ve been experimenting with something similar. The purpose of -ExpandProperty is to convert an object to string, so that another cmdlet’s parameter can accept it, right? However, in a custom property...
View ArticleReply To: Is there a better way to expand a calculated field?
-ExpandProperty doesn’t necessarily convert to a string. It takes a property that can have one, or more, values and supplies you with the value(s). Those values could be of any type. In other words it...
View ArticleQuery multiple servers for performance counters in parallel
I’ve written a script to query multiple Hyper-V hosts for some metrics, then using some logic, returns the name of host, that I can then use to create a vm on. Here is my script, note being I haven’t...
View ArticleReply To: Query multiple servers for performance counters in parallel
If you have PSRemoting enabled on the target servers, the simplest approach would be to use Invoke-Command. When you pass it an array to the ComputerName parameter, it automatically does the operation...
View ArticleReply To: Query multiple servers for performance counters in parallel
This code still collects each counter synchronously on the remote computers, but process the computers themselves in parallel. If you need to parallelize the counter collection as well, that’s...
View ArticleReply To: Query multiple servers for performance counters in parallel
I didn’t know about New-Object, more reading to do. If I want to run the commands synchronously on each remote machine, would you recommend using a workflow? As it is at the moment, I will keep the...
View Article