Reply To: Converting WMI Date and Time
Ah. Custom class. You didn’t mention that, and it’s important. The ConvertToDateTime method is dynamically added by PowerShell, but it wouldn’t know to do that to your custom class. So, yeah, in that...
View ArticleReply To: Converting WMI Date and Time
Richard Siddaway wrote:If the end points are v2 you can still use the CIM cmdlets but you have to create a DCOM based CIMsession to the endpoint if you are staying with wmi cmdlets looks like your code...
View ArticleReply To: JavaScript problem with EnhancedHTML module
Yeah… you were about 12 mins too late on that pick up…
View ArticleReply To: Converting WMI Date and Time
By the sound of it, you were using code like this: (gwmi namespacegoeshere -ComputerName ‘test’).endtime | ForEach-Object { [System.Management.ManagementDateTimeConverter]::ToDateTime($_.endtime) }...
View Articlehelp to output array
first of all, sorry for my english…hello all, thanks for all your help in advance, im trying to list speceifc services in specific servers. this is part of a procedure where i try to check service...
View ArticleReply To: help to output array
There are a number of problems with your script including: - the array structure you’ve used doesn’t work - you’ve used format-table and then tried to access the results which is what is giving you the...
View ArticleReply To: JavaScript problem with EnhancedHTML module
FYI, I found a little bug in the EnhancedHTML module. Just a couple of minor tweaks to fix it, and it may have broken something else…In some further testing, I found that the highlighting didn’t work...
View ArticleReply To: help to output array
Another option is to create a custom PSObject: $data = @() $data += New-Object –TypeName PSObject -Property ` (@{'ComputerName'="server10"; 'Name'= @("Spooler", "Server", "Workstation");}) $data +=...
View ArticleReply To: JavaScript problem with EnhancedHTML module
I’m not sure I ever intended alternate-row coloring to work with the “-As List” mode, to be honest. I’m actually looking to rewrite the entire module to make it a bit easier to use – I’d like it to...
View ArticleReply To: Formatting question
Try this Set-Content -Path computers.txt -Value ((Get-ADComputer -Filter * | select -ExpandProperty Name) -join “,”)
View ArticleFormatting Output
Hi Experts,I’m relatively new to Powershell and I’m having some problems getting things to output in the format that I want. I have created the code below to run through a list of servers, determine...
View ArticleReply To: Formatting Output
It outputs to the screen because Write-Host can’t do anything but that. You probably want Write-Output instead. It’s kind of a lot of underlying things going on; if you get a sec, grab yourself a copy...
View Article[PowerShell] Methods – BeginStop
Hi all,So! I’m using a runspace pool to parallelize a task. One of these gets hung up (running query.exe user /server:blah).How do I end a PowerShell pipeline asynchronously? I see a BeginStop method,...
View ArticleReply To: Formatting Output
I agree completely with Don regarding “Learn PowerShell 3 in a Month of Lunches.” It is the best book from which to learn PowerShell.To solve your problem try something like this $servers = "server02",...
View ArticleReply To: [PowerShell] Methods – BeginStop
Odd, turns out you can’t edit a post?Anyhow, Jaykul helped out a bit – just need to provide a callback scriptblock. Now (presumably) the powershell pipeline is stopped and I dispose of it…...
View ArticleReply To: [PowerShell] Methods – BeginStop
Try PowerShell.Stop() instead of BeginStop. BeginStop is an asynchronous method, but your code structure looks like you’d be better off using the synchronous version.
View ArticleReply To: [PowerShell] Methods – BeginStop
Hi Dave,To clarify, I’m doing this for an update to Invoke-Parallel which was a ‘I have no idea what I’m doing here but this makes things faster’ first stab…The updated code is here. One of two things...
View ArticleReply To: [PowerShell] Methods – BeginStop
Even looking at the complete code, it looks to me like you should be using the synchronous version ( Stop() instead of BeginStop() ). I’m not sure what the consequences are of calling BeginStop() and...
View Article