none
Not receiving all data while running a script RRS feed

  • Question

  • Hello, I have been working on this script the last few days now and get farther and farther on it. Yesterday I finally thought I had it all complete and went to implement on a server. When I finally moved it over and did a test run the only data I was sent was two things Success and seconds. I didn't actually get the date or anything else. When I says seconds it just said that but didn't actually get me any data. When I ran this on me machine before I moved it over it was working. When I moved it back to my computer and tried again I am no longer getting the same results. For some reason it worked for awhile but no it isn't.

    $cred = Import-Clixml -Path C:\users\passworddoc.xml
    $url = "siteURL"
    $response=Invoke-WebRequest $url -Credential $cred
      
    
       if ($response.statuscode -eq 200) {
          "Success`t`t" + $startTime.DateTime + "`t`t" + ($endTime - $startTime).TotalSeconds + " seconds" | Out-File "C:\Users\T&E.csv" -Append
       } else {
          "Fail`t`t" + $startTime.DateTime + "`t`t" + ($endTime - $startTime).TotalSeconds + " seconds" | Out-File "C:\Users\T&E.csv" -Append
       }



    Thursday, February 12, 2015 2:20 PM

Answers

  • You apparently had something setting $startime and $endtime when you were testing.

    Whatever it was doesn't appear to be part of that script, so those values are going to be null.  


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    • Marked as answer by bohlingj Thursday, February 12, 2015 2:51 PM
    Thursday, February 12, 2015 2:45 PM
    Moderator

All replies

  • You apparently had something setting $startime and $endtime when you were testing.

    Whatever it was doesn't appear to be part of that script, so those values are going to be null.  


    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

    • Marked as answer by bohlingj Thursday, February 12, 2015 2:51 PM
    Thursday, February 12, 2015 2:45 PM
    Moderator
  • Aw, good catch. I am still learning powershell so it is easy for me to look over something easy like that.

    $startTime = get-date
    $endTime = get-date
    Thursday, February 12, 2015 2:51 PM