Search found 99 matches

by EBrant
Sat Feb 02, 2013 2:29 am
Forum: Windows PowerShell
Topic: DateTime question.
Replies: 3
Views: 1282

DateTime question.

Hello All Can someone please help with the following question With the Get-Date you can use the Format operator like so Get-Date -Format "MM/dd/yyyy" But is appears you cannot do the following (Get-Date ).AddDays(-99) -Format "MM/dd/yyyy" Naturally both Get-Date and (Get-Date).AddDays(-99) are DateT...
by EBrant
Fri Jan 18, 2013 1:22 am
Forum: Windows PowerShell
Topic: Is there a way to set a time limit of an individual powershell command.
Replies: 1
Views: 889

Is there a way to set a time limit of an individual powershell command.

Hello All when doing the following type of thing $ErrorActionPrefference="Continue" foreach ($Computer in $Computetlist) { try { get-wmiobject win32_bios -computername $computer } catch {some code here} } I get the odd RPC failure and Access denied which I am not concerned about. However there are a...
by EBrant
Thu Jan 17, 2013 11:35 pm
Forum: Windows PowerShell
Topic: Is is possible to read a file from the bottom up rather than the top down
Replies: 2
Views: 1536

Is is possible to read a file from the bottom up rather than the top down

Hi Jim,

Ya I guess as a file is read up until the EOF (end of file) marker, and by definition that is at the end of the file, which of course you have just read to get to the EOF marker. :)

Thanks
Ernie
by EBrant
Mon Jan 14, 2013 5:22 am
Forum: Windows PowerShell
Topic: Is is possible to read a file from the bottom up rather than the top down
Replies: 2
Views: 1536

Is is possible to read a file from the bottom up rather than the top down

Hello All Can someone please help me with the following question. Then doing things like $File = get-content c:tempmyfile.txt I understand the whole file is read into memory, you can then iterate through the file with foreach or $File[2] for example. Now I am only interested in the contents near the...
by EBrant
Sun Dec 23, 2012 5:26 am
Forum: Windows PowerShell
Topic: Need a little assistance with string manipulation
Replies: 6
Views: 1776

Need a little assistance with string manipulation

Hello if you want to get the number at the beginning of the line no mater how long it is and not mater if it has a fraction i.e. .5 or .54 etc use RegEx here is a couple of quick dirty examples cls "573.5 MB (601,342,765 bytes)" -match "^d+(.d+)?" | Out-Null $Matches[0] # set $matches to null before...
by EBrant
Sun Dec 23, 2012 2:00 am
Forum: Windows PowerShell
Topic: Multiple Matches
Replies: 3
Views: 918

Multiple Matches

Hello All Can someone please help me with the following question, I am using PowerShell v2.0 and therefore the .NET regex engine. I am doing a conditional look ahead capture, basically I am saying look ahead for the character 9 or 7 if you see either 9 or 7 capture it into group 1. If you do not see...
by EBrant
Fri Nov 30, 2012 8:09 pm
Forum: VBScript
Topic: Filtering TimeGenerated in WQL
Replies: 2
Views: 3144

Filtering TimeGenerated in WQL

Thanks Jim, I will check it out :)
Ernie
by EBrant
Fri Nov 30, 2012 1:21 am
Forum: VBScript
Topic: Filtering TimeGenerated in WQL
Replies: 2
Views: 3144

Filtering TimeGenerated in WQL

Hello All Can someone please help me with the following question. I have a script as follows: Basically it echos Ernie to the screen for every 1001 event "as long as the event was created today" Now what I would like to do is filter the WQL further by adding AND TimeGenerated for example TempStr bel...
by EBrant
Mon Nov 12, 2012 6:44 pm
Forum: Windows PowerShell
Topic: Early Filtering of Win32_NTLogEvent class
Replies: 1
Views: 969

Early Filtering of Win32_NTLogEvent class

Hello All, Just to let you know, Aleksandar replied on another forum re this query and found the following answer, so thought I would share here for benefit of forum users. Reply Aleksandar replied on 11-12-2012 10:55 AM rated by 0 users What version of PowerShell do you have on your client? It look...
by EBrant
Sun Nov 11, 2012 3:24 am
Forum: Windows PowerShell
Topic: Early Filtering of Win32_NTLogEvent class
Replies: 1
Views: 969

Early Filtering of Win32_NTLogEvent class

Hello All, Can someone please help with the following query :) if I do the following I have to wait until all warning events are collected by WMI before they are then passed down the pipeline to select the First 1. This slow the whole thing down, I therefore want to filter the first event only in th...