Want to get the Output as Percent to compare it easily with Get-PSDrive in Python

46 views Asked by At

I want to get the Used (GB) & the Free(GB) from a partition to compare it for monitoring, i have a script.

import winrm
s = winrm.Session('ipadress', auth=('Name', 'password')) command = "Get-PSDrive | Where {$_.Free}" r = s.run_ps(command) result = r.std_out converted = str(result, encoding='utf-8', errors='errors') print(converted)

the Output is this:

Name           Used (GB)     Free (GB) Provider      Root
----           ---------     --------- --------      ----
C                  63.25         26.15 FileSystem    C:\ 

I Want to get the % from the free space or the used space as a float to compare this value.

0

There are 0 answers