Search

  • Re: Extract text and numeric values from a text file

    Well, answering my own question, I came across some functions that enable converting hush table to objects and do all kind of formatting. Now Im still having a problem using foreach loop with the hash table. foreach ($line in (Get-Content "C:\Scripts\Logs\Test\Test Backup One_Log_Page1.txt")) { if($line -match "Profile Name" -or $line -match "Deleted" -or $line -match "Skipped" -or $line -match "Copied" ` -or $line -match "Copied/Moved"
    Posted to PowerShell for Windows (Forum) by PLeskov on 05-08-2012
  • Re: Extract text and numeric values from a text file

    Thanks! With a slight adjustment it works great! foreach($line in (Get-Content $logfile)){ if($line -match "Profile Name" -or $line -match "Deleted" -or $line -match "Skipped" -or $line -match "Copied" -or $line -match "Copied/Moved" -or $line -match "Profile End Time" -or $line -match "Result"){ $table = @{$line.split(",")[2]=$line.split(",")[3]} $table } } Now how do I output only the values of the array to
    Posted to PowerShell for Windows (Forum) by PLeskov on 05-03-2012
  • Re: Extract text and numeric values from a text file

    Hi Felipe, Your solution works but it solves only part of the problem. I still need to filter the data and extract only those specific values. I got 59 log files with couple of thousands lines in some of them. My goal is to extract only the valuable backup data and output it in a single file formatted as a table. Something like this: Profile Name Deleted Skipped Copied Copied/Moved Profile End Time Result Test Backup 5 3 44 35.8MB 4/30/2012 1:41:13 PM Success Mirror Noon 356 288 25 56.5MB 4/30/2012
    Posted to PowerShell for Windows (Forum) by PLeskov on 05-01-2012
  • Extract text and numeric values from a text file

    I’m new to powershell regular expressions and have a question on how to write one that would extract text and numeric values from .txt log files. Here is a sample of the log file. Note: There are no spaces between the string lines in the original file: "4/30/2012 10:47:03 AM","1","About","SyncBackPro V6.0.12.0 Log",0,"O" "4/30/2012 10:47:03 AM","1","Profile Name ","Test Backup - 1", 0,"O" "4
    Posted to PowerShell for Windows (Forum) by PLeskov on 04-30-2012
    Filed under: regular expression regularexpression powershell regexp
  • Re: Send output of Get-QADUser command to multiple e-mail recepients

    Don, Thanks again for you help! Here is the final script that was tested and it works just fine. I've added a message to the text file that will be e-mailed and also modified the content to make it more readable for the users. Set-location C:\Scripts $pathtxt = "C:\Scripts\ExportADusers.txt" add-pssnapin quest.activeroles.admanagement $users = Get-QADUser -sl 0 -department "Information Technology" -IncludeAllProperties -Serializevalues | select DisplayName,userprincipalname
    Posted to Ask Don Jones (Forum) by PLeskov on 11-21-2011
  • Send output of Get-QADUser command to multiple e-mail recepients

    Hi Don, I'm a SysAdmin and just started using PowerShell so I'm going through the learning curve. Here is the script that uses Quest Get-QADUser command to quiery AD Users OU and output it to a text file which then is e-mailed to me. I used Format-List command so each user is listed separately. Here is my question: how can I make it send the output for each user account to their e-mail addresses separately, instead of sending the whole list to just one recipient (myself). The idea is to send
    Posted to Ask Don Jones (Forum) by PLeskov on 11-16-2011
  • Re: Send output of Get-QADUser command to multiple e-mail recepients

    Don, you are awesome! Thanks for your solution and for the tips. I just tested the script and it works. But I do have one problem with e-mailing. The userPrincipalName is not the valid e-mail address. Here is the userPrincipalName format: firstinitiallastname@mycompany.priv (in my private domain), the e-mail addresses is in this format: firstinitiallastname@mycompany.com . Is there a workaound to fix that? Appreciate your help! Paul
    Posted to Ask Don Jones (Forum) by PLeskov on 11-16-2011
  • Re: Send output of Get-QADUser command to multiple e-mail recepients

    Wow! The whole script works perfectly now. I want to insert a message in the automated e-mail text, do a couple of more tests and will post the whole script. Thanks so much for your help! Paul
    Posted to Ask Don Jones (Forum) by PLeskov on 11-16-2011
Page 1 of 1 (8 items) | RSS | More Search Options
Copyright 2012 PowerShell.com. All rights reserved.