Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8758609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:35:36+00:00 2026-06-13T14:35:36+00:00

Ok, so this may be an odd request but I am new to powershell

  • 0

Ok, so this may be an odd request but I am new to powershell but have been playing with it for a few days and had an idea but not to sure how to do it. I want to make a results table that will look something like the following.

Computer Name(s)   Attempt(s)   Result          Last Attempt
Computer1          1            Successful      9:31 25 Oct 12
Computer2          24           Unsuccessful    12:08 25 Oct 12
Computer3          9            Successful      11:22 25 Oct 12
Computer4          11           Unsuccessful    04:11 25 Oct 12
Computer5          12           Unsuccessful    07:19 25 Oct 12

I put together a command that seems to get the result I want but needs some tweaking to get the additional functionality that i require.

( Get-Content .\~temp.txt ) | Foreach-Object {$_ -replace "$Computername,.*", ($Computername + "," + $Attempts + "," + $Result + "," + $Time.ToShortTimeString() + "," + $Time.ToShortDateString())} | Set-Content .\~temp.txt

First things firsts. I need to load all the computers from the text file (Computers.txt) and load each one of them into the new file(~temp.txt) I was thinking something along the lines of the following.

(NOTE:Untested Yet, just an idea)

$Computers = Get-Content .\computers.txt
IF (Test-Path .\~temp.txt) {
      IF ( Select-String .\~temp.txt -pattern $Computer -quiet ) {} ELSE { Add-Content ./~test.txt "$Computer," }
} ELSE {
      ForEach ($Computer in $Computers) {
      add-content .\~temp.txt "$Computer,"
}

Next is pulling the number of attempts from the line and the last result. I honestly can’t find how to do this, hoping someone can show me how to do this with some comments that explain how they did it, or for some direction on what i should be googling. Thank you for taking the time to read this, any/all help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:35:37+00:00Added an answer on June 13, 2026 at 2:35 pm

    Well figured it out 🙂 for anyone else who wants to know

    $UpdateLog = Select-String .\~Temp.txt -pattern $ComputerName 
    $Attempts = $UpdateLog.ToString().Split(",")[1] 
    $Result = $UpdateLog.ToString().Split(",")[2]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may seem like an odd question, but I have my own reasons for
This may at first seem like an odd question, but when a cin request
I know this question may seem odd due to new existing alternatives, but trust
This may seem like an odd question but I was talking to a friend
This may be a stupid question but I have a code with the following
This may be have a better name than custom tab completion, but here's the
This may be the wrong place but this is new to me. I did
This may sound like a very generic question but here it goes. I have
this may seem a little odd, but it would make for a convenient way
This may seem a bit odd, but I really need to create a workaround

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.