SHARE
TWEET

Untitled

a guest Apr 19th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #param
  2. #(
  3. #    [Parameter(Mandatory=$true)][String]$USRName#,
  4.     #[Parameter(Mandatory=$true)][String]$PSTDate
  5.     #[Parameter(Mandatory=$true)][String]$PSTTime
  6.     #[Parameter(Mandatory=$true)][String]$CoRelationID
  7. #)
  8.  
  9. $Temp_USRName = "*USR19691-242*"
  10. $Temp_PSTDate= "*20190417*"
  11. $Temp_PSTTime= 2315
  12.  
  13. $Temp_BuildUSRPath = "C:\Users\t-adgarg\Documents\USR19691-242\ULSLogs\"
  14. #$BuildUSRPath = "\\" + $USRName + "\" + "ULSLogs"
  15.  
  16.  
  17. #write-host $BuildUSRPath
  18.  
  19. #invoke-expression $BuildUSRPath
  20.  
  21. #search for file
  22. $source = "C:\Users\t-adgarg\Documents\Shane"
  23. $files=@("*.log")
  24.  
  25. #$a= Get-ChildItem -recurse $files -include ($files)
  26.  
  27. $files = Get-ChildItem $Temp_BuildUSRPath -Filter *.log | Where-Object {$_.Name -like $Temp_USRName  -and $_.Name -like $Temp_PSTDate}
  28. $number_of_files = $files.length
  29.  
  30.  
  31. $files_striped = $files -replace ".*-" -replace "\..*$"
  32. #$files_striped = $files_striped.Split('.')[0]
  33.  
  34. #$files_striped2 = @()
  35. $files_striped = [System.Int32[]]$files_striped
  36.  
  37. #$files_striped2[1] = [int]::Parse($files_striped[1])
  38.  
  39. $number_of_files = $files_striped.length
  40.  
  41. $files_striped -is [Array]
  42.  
  43. write-host "$($files)"
  44. write-host "$($files_striped)"
  45.  
  46. write-host "$($number_of_files)"
  47.  
  48.  
  49. #StartTime '2019-04-19 02:40:08' -EndTime '2019-04-19 02:40:53'
  50.  
  51. $i = 0
  52. $flag1 = 0
  53. while($number_of_files -gt 0)
  54. {
  55.    if($Temp_PSTTime -eq $files_striped[$i])
  56.    {
  57.        $
  58.        $flag1 = 1
  59.    }
  60.  
  61.    else if($Temp_PSTTime -gt $files_striped[$i]) -and (($Temp_PSTTime -lt $files_striped[$i+1]))
  62.    {
  63.  
  64.        $flag1 = 1
  65.    }
  66.  
  67.    $i++
  68.    $number_of_files--
  69. }
  70. write-host "$($files_striped2)"
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. #Start-Process UlsViewer++ $files[$unknown]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top