| Topic |
 |
RE: compare 2 csv files Yes I'm headed down the same path now. I was hoping I missed something more elegant than matching each one against the list "manually" by jim_b in General PowerShell on 17 Feb 2012 05:33 AM
|
 |
RE: compare 2 csv files compare-object doesn't seem to have a "like" operator. eg if this is a list of software so if list1 has a name of "office" I need it to match "office 2007" and "office 2010"ideally I'd like the output to be all matches of the comparison string so i ... by jim_b in General PowerShell on 16 Feb 2012 08:28 AM
|
 |
compare 2 csv files I am trying to write a script that compares 2 similar (but not the same) csv files. Both CSV files have a name column that I want to compare on. The challange is that I can't figure out how to use the -like operator in a loop to compare the 2 lis ... by jim_b in General PowerShell on 16 Feb 2012 07:36 AM
|
 |
get-eventlog confusion I wanted to get a quick report of some log entries I saw on a server, so I ran:Get-Eventlog -logname system -newest 10 -computer fs1 | flI got events back however the descriptions were all wrong. Here's an example:Index : 1260055 EntryType : Warning ... by jim_b in General PowerShell on 25 Jan 2010 06:56 AM
|
 |
RE: Monitoring windows services You cold also configure the service on the computer in question to run a script on failure (see the recovery tab, run a program) This will allow you to choose cscript, powershell etc and have that send an email. This has the benefit of not having ... by jim_b in General PowerShell on 30 Nov 2009 12:45 PM
|
 |
RE: copy-item -force -recurse forces me to curse... Ahh but according to the help file it seemed like it should:"Example 3 C:\PS>copy-item C:\Logfiles -destination C:\Drawings\Logs -recurse This command copies the contents of the C:\Logfiles directory to the C:\Drawings\Logs directory. It will create ... by jim_b in General PowerShell on 30 Nov 2009 12:15 PM
|
 |
RE: copy-item -force -recurse forces me to curse... Chris, Yes I modified the file on my workstation to use M: to get the error to reproduce ( I couldn't copy/psate from the server). I thought that -force -recurse would create the path if it doesn't exist, so I added that so that as the months progre ... by jim_b in General PowerShell on 30 Nov 2009 10:58 AM
|
 |
copy-item -force -recurse forces me to curse... First here's what works:#Where are we going? $destination = 'f:\grp\unix\daily logs\' + (get-date -uformat %Y) + "\" + (get-date -uformat %m) + "\" #what are we putting there $fname = "na_" + (get-date -uformat %Y%m%d) + 'dailylog.xls' # create t ... by jim_b in General PowerShell on 30 Nov 2009 10:29 AM
|
 |
RE: Parsing filenames ok So now I'm confused, is it that you can only use properties with the $_.property nomenclature excelt when evaluated as strings? In which case you need to encliose them in $() ? by jim_b in General PowerShell on 29 Sep 2009 02:37 PM
|
 |
RE: Parsing filenames AHH replace is a comparison operator - I would have never thought to look in there. That's a great question. I'm pretty good with the regex stuff (but thanks for the link). I'm also wondering why the copy destination is "-dest "z:\$directory\$($_ ... by jim_b in General PowerShell on 29 Sep 2009 08:14 AM
|
 |
RE: Parsing filenames I knew that basenames were in v2. I'm on v1 for production. The sercret sauce however is " $directory = $_.name -replace "\D+","$1" Where can I find out about -replace? I went searching for any sort of string maniplulation and just couldn't find ... by jim_b in General PowerShell on 29 Sep 2009 06:49 AM
|
 |
Parsing filenames I am trying to replace a bunch of unix scripts with powershell scripts. I am 90% there but stuck on a bit that parses filenames. The bit of code I am working on needs to get a directory of a file, get the newest file that starts with the string "q ... by jim_b in General PowerShell on 28 Sep 2009 05:15 PM
|
 |
RE: write-host vs console Thanks, what would be the proper way for a function to return an object. I can easily see how to do it via side effect (leaving $applog hanging there) but is there a way to do something like get-remoteapplog mysystem | select eventid, id. by jim_b in General PowerShell on 25 Aug 2009 08:29 AM
|
 |
write-host vs console I have a function:function get-remoteapplog { param([string]$system) $logs = [System.Diagnostics.EventLog]::GetEventLogs($system) $applog = $logs[0].entries write-host $applog}The problem is with write-host. If I just type $ ... by jim_b in General PowerShell on 24 Aug 2009 10:00 AM
|