Finding attributes for objects
Hi, Still very much a noob with Powershell, but managing to fumble my way through. I’m having some difficulty when it comes to writing some scripts when I want to look at a particular attribute of an...
View ArticleReply To: Finding attributes for objects
Typically, you’d use the Get-Member cmdlet: $someVariable | Get-Member # or: Get-Member -InputObject $someVariable Those two examples are subtly different, if $someVariable happens to be a collection....
View ArticleReply To: Replace special character in powershell
PowerShell’s -replace operator uses regular expressions, and also works well on collections. If your $c variable happens to just be a single string (not a collection of strings), though, you can also...
View ArticleReply To: Twitter Module?
Have you seen this: https://devcentral.f5.com/articles/introducing-poshtweet-the-powershell-twitter-script-library#.UvJg0Y3iuVM
View ArticleReply To: Export-Csv to a hidden file
Don’t think you can – that’s the whole point of hidden files
View ArticleReply To: Finding attributes for objects
Awesome, thank you. I knew it was something like that but could only remember get-content. Obviously, I’m still some ways off mastering PS… Thanks for the timely response.
View ArticleHelp! Custom properties and piping
Hi Guys, Pretty new to powershell here and was just learning it using the Morelunches book on Powershell and came upon one of the labs in chapter 9 that got me a bit confused. The commands are...
View ArticleReply To: Help! Custom properties and piping
There’s a kinda-bug in the Get-Hotfix documentation; it turns out it won’t accept pipeline input, although the original docs tag it as doing so. So in theory both commands work, but in practice you...
View ArticleReply To: Export-Csv to a hidden file
What’s the goal in hiding it? To prevent another process from “seeing” it as it is created? In that case, create it in a different folder, and then move it when it’s done.
View ArticleReply To: Help! Custom properties and piping
Ahh. No wonder! That left me scratching my head a bit. That’s good to know. Is there any place where I would have been able to find this information on my own or am I pretty much limited to googling...
View ArticleReply To: Help! Custom properties and piping
Oddly, the documentation for Get-Hotfix mentions this anomaly. You’d just have to read the full help file. That is a hash table. The technique is actually described in the first Lunches book. In this...
View ArticleReply To: Help! Custom properties and piping
Oh, I guess I should read the -full helps more often. For the hash table, what does the “l=’computername’” do? I’m assumed it assigned the ‘l’ variable something but turns out I was incorrect because...
View ArticleInvoke-Webrequest Powershell 2.0
I have a script I need to deploy to a high number of servers. Most of which are pshell 3.0 but with some version 2.0. Could anyone give me some advice on how to recreate the following code to work in...
View ArticleReply To: Help! Custom properties and piping
“L” isn’t a variable. Hashtables consist of one or more “key=value” pairs. In this case, two, with the keys being “L” and “E.” The Select-Object command is hardcoded to look for specific keys: L, l,...
View ArticleReply To: Help! Custom properties and piping
That all made perfect sense. Thanks again for the guidance, it’s helped a lot!
View ArticleReply To: Export-Csv to a hidden file
Dynamically create a temp file, and as Don said, move it when you’re done. PS foo:\> $path = [IO.Path]::GetTempFileName() PS foo:\> $path C:\Users\bob\AppData\Local\Temp\tmp1CA9.tmp PS foo:\>...
View ArticleDriver-update-history of a specific device thru Powershell
How can I get the driver update history of a specific device thru Powershell. I thought one could track it thru “Win32_DeviceChangeEvent”; but couldn’t. One can’t even search the eventlogs or an...
View ArticleReply To: Invoke-Webrequest Powershell 2.0
I’ve only used Invoke-WebRequest, personally, but I’ve seen examples of the underlying .NET classes as well. It’ll take some testing (and probably fixing), but I think it’ll wind up looking something...
View Article"Inventory Intervention" – Processor inventory script
Hello, I am trying to do exactly what was in the 2013 scripting games event 2. I’ve been trying to find Mike Robbins script and can’t as the link on his site isn’t working. But I have an environment...
View ArticleReply To: Export-Csv to a hidden file
Thank you guys. I was afraid there would be no way, but a workaround, but what to do? Cheers
View Article