Reply To: string manipulation
hi, If you love to hate regex (sorry Dave), this also works: $name = $text -split [environment]::NewLine | foreach { if($_.startswith("Name")){$_.split(":")[1]} } $name or $name = $text -split "`n" |...
View ArticleReply To: Schedule rolling reboots with service check & email?
hi, you can start with this? $servers = @("server1","server2") $Body = "server was rebooted at" $mailParam = @{ To = "Dude@contoso.com" Subject = "Server rebooted" From = "noreply@contoso.com"...
View ArticleReply To: string manipulation
I can’t help it. I learned regular expressions at a formative age, and now they’re like my coding security blanket.
View ArticleReply To: Review Request- How 2 Simplify
Hi Tore, Thank you very much for taking the time to respond. I’m somewhat new to powershell & am also not accustomed to ‘best practices’ when posting examples. I’ll do better with the non-alias...
View ArticleSelect-Object to use property and expand property
Hi, I have a small issue, how to use both property and expand property at the same time. Though they are in same parameter set, i am unable to use it. Select-Object [[-Property] <Object[]>]...
View ArticleReply To: Select-Object to use property and expand property
I can reproduce this in PowerShell 2.0, but in 4.0 it works fine. Not sure about 3.0; I don’t have a system handy that hasn’t been upgraded to 4.0 right now.
View ArticleReply To: Running get-childitem on remote server to check file versions
I got it working. Thanks everyone for the help. I changed things up and now have everything outputting to a file. Thank you for your suggestion. It does work rather nicely. Here is the file code of...
View ArticleReply To: PowerShell DSC: Composite Configurations / Node GUID Management
I think we’re probably a little early on for real practices to have emerged. I think, in the long view, we need to view DSC as a platform technology – not as tooling. We do need tooling around it. I...
View ArticleDeploy powershell 5? Group policy?
What would be the easiest way to deploy Pshell 5? I am very interested in using the install-package functionality. Can you configure machines to get this through windows update?
View ArticleReply To: Deploy powershell 5? Group policy?
PowerShell 5 is ABSOLUTELY BETA code and is NOT intended for deployment at this time. How you install it now is very different from how you install it when it’s finally released. I don’t think we...
View ArticleSECOND TEST
These tests are related to a change in the mailing list we use to distribute new-post notifications. You may see notices coming from @listbox.com if we make the transition.
View ArticleFiltering based on calculated properties
Hi guys, I have a new problem, where I got stuck: I am generating a huge csv report, where I would like to remove a lot of rows. But there are so many, that Excel can’t handle them. So, I thought I...
View ArticleReply To: Filtering based on calculated properties
Sure, you can, but you may find that you get better performance with filtering first, then adding the calculated property. Either of these should work: dir C:\ -recurse | Where-Object { $_.Length -gt...
View ArticleProblems reading in from array
Hi, I’m having some issue with following script: $Computers = get-adcomputer -filter * -searchbase "ou=computers,dc=domain,dc=com" | foreach-object {$_.name} foreach ($computer in $Computers)...
View ArticleReply To: Problems reading in from array
Your ForEach-Object is a bit of an odd way to do what you’re after… Get-ADComputer -filter * | Select -Expand Name Is a bit more common. The errors are coming from inside your Get-WindowsKey function....
View ArticleReply To: Problems reading in from array
Hey Don, thank you for your response. I’ll make that amendment to the script, thanks for the suggestion. I noticed as soon as I posted that the error looked to be stemming from the function itself....
View ArticleReply To: Problems reading in from array
Looks like all you really need is some error handling. If the ([WMIClass]“\\$target\root\default:stdRegProv”) expression throws an error such as RPC Server is Unavailable, there’s really no point in...
View ArticleReply To: Logging an Event into Windows Event Logs
Hi All Im still struggling with this issue, appreciate any help if you have the time. Thanks Francis
View ArticleBug in PS V4 ping > ctrl + pause > ctrl+c closes
Hi all. Actually I’m learning powershell in mva. I’m finishing basic powershell V3.0 and advanced scripting courses. I have powershell V4 installed in my two machines (personal and job computers). One...
View Article