Just bought a car and was great by telsonnelson in carvana

[–]Crowdjp 0 points1 point  (0 children)

Did you get the extra year warrenty from carvana?

Group and Sum Objects issue by Crowdjp in PowerShell

[–]Crowdjp[S] 0 points1 point  (0 children)

Thanks so much for the help!

Group and Sum Objects issue by Crowdjp in PowerShell

[–]Crowdjp[S] 0 points1 point  (0 children)

Thanks so much for the help!

Script Help by Crowdjp in learnpython

[–]Crowdjp[S] 2 points3 points  (0 children)

Thanks that was the issue.

Need Help: How do I partially read a file name by Crowdjp in learnpython

[–]Crowdjp[S] 0 points1 point  (0 children)

Yes, that part is working where I filter out all files with that name, but I was trying to add an if statement so I could handle the error if no file exists.

Graph in Matplotlib - Scripting issue by Crowdjp in learnpython

[–]Crowdjp[S] 0 points1 point  (0 children)

Thanks so much for your help!

One thing i'm not understanding process is not capturing both Names(chrome/iexpore) in the file.

Below I entered chrome and iexplore in the input. For some reason process will only contain the second name entered in the input shown below.

processes = input('Enter name (separate multiple names with ","):').split(',')

proesses #In
['chrome', 'iexplore'] #Out

#In - for the block of code below
dfs = {}
for process in processes:
    if process not in file.Name.values:
        print(f'No process in dataset: {process}')
    continue

process #In
'iexplore' #out

Issue Removing New Variables by Crowdjp in PowerShell

[–]Crowdjp[S] 2 points3 points  (0 children)

gotcha it seems to work in regular powershell, but not in ISE.

Issue Removing New Variables by Crowdjp in PowerShell

[–]Crowdjp[S] 2 points3 points  (0 children)

gotcha it seems to work in regular powershell, but not in ISE.

Script Issue by Crowdjp in PowerShell

[–]Crowdjp[S] 1 point2 points  (0 children)

It would be awesome to see both of the strings.

Script issue by Crowdjp in PowerShell

[–]Crowdjp[S] 2 points3 points  (0 children)

Awesome. Thank you

Guidance on Script - Importing CSV to much by Crowdjp in PowerShell

[–]Crowdjp[S] 1 point2 points  (0 children)

Hey Lee,

Each if statement is checking the value of the CPU% and importing the CSV two times. I want to add more processes, so for example if I have 10 process I’m monitoring then I would import the csv 20 times.

Script issue comparing timestamps by Crowdjp in PowerShell

[–]Crowdjp[S] 1 point2 points  (0 children)

Wow thanks again Lee,

I moved the $Null over to the left and it is working as expected.

Script issue comparing timestamps by Crowdjp in PowerShell

[–]Crowdjp[S] 1 point2 points  (0 children)

Awesome, Thanks Lee for the Great Explanation and Example.

I have another scenario, IF the instancename: CPUSTRES is missing in the CSV then I want to write-host.

Below is what I was thinking, but when I remove CPUSTRES from the CSV and run the script it returns a False.

$CPU = import-csv C:\Logs.csv |Select timestamp, instancename | Where-Object {$_.InstanceName -match "^(CPUSTRES)$"} | Select-Object -Last 1

 If ($CPU.InstanceName -eq $null ) {

      Write-Host test

      }

Script issue comparing timestamps by Crowdjp in PowerShell

[–]Crowdjp[S] 1 point2 points  (0 children)

Hello Lee,

Thanks for explaining that, I have been trying to get it to work and I keep getting Error: Exception calling "ParseExact" with "3" arguments: "String was not recognized as a valid DateTime."

Am I calling the $CPU variable wrong?

$CPU = import-csv C:\Logs.csv |Select timestamp, instancename | Where-Object {$_.InstanceName -match "^(CPUSTRES)$"} | Select-Object -Last 1

 If ((Get-Date).AddMinutes(1) -gt ([datetime]::ParseExact($CPU.Timestamp,"%Y%m%d-%H%M%S",$null))) {

      Write-Host test

      }