Help with Total volume capcity minus OS install.


i working on providing disk space capacity on our servers.  thought had figured out calculations not correct.

i able find totalcapacity , totalfreespace have step remove 80 totalcapacity give final capacity per server.

so have list of servers in csv

import-csv $infile |  	foreach-object {  		$computer = $_.computername    $adjustment = 80      later in script:    $volumes = get-wmiobject -computer $computer -credential -class 'win32_volume' -filter 'drivetype=3'    $volumes |  foreach-object {				$volume = $_  $volumename = $volume.name  write-debug "`$volumename:,$volumename"  #$size = 0  #$volumecapacity = $volume.capacity  $totalcapacity += $volume.capacity  #$freesize = 0  #$volumefreespace = $volume.freespace  $totalfreespace += $volume.freespace  }  $adjustedcapacity = $totalcapacity - $adjustment      inputobject:  add-member -inputobject $properties -name 'total allocation (gb)' -value ($totalcapacity / 1gb).tostring("n2") -membertype noteproperty     add-member -inputobject $properties -name 'subtracted amount (gb)' -value $adjustment.tostring("n0") -membertype noteproperty     if ( $totalcapacity ) {  			$usedpercent = (($totalcapacity - $totalfreespace)/ $totalcapacity).tostring("p2")  		} else {  			$usedpercent = 0  		}    add-member -inputobject $properties -name 'used %' -value $usedpercent -membertype noteproperty     		add-member -inputobject $properties -name 'final adjusted allocation (gb)' -value ($adjustedcapacity / 1gb).tostring("n2") -membertype noteproperty   

i'm hoping see total | subtracted amount | used | adjusted allocation, total , adjusted allocation same.  $adjustment size not being reduced totalcapacity.  don't see error , not sure why.

please advise.

thanks,


jr. admin

well want thank input.  i'm still learning , trying figure out how ps works.  wanted share findings in case noobie has entry level issues.

as turns out, figured out adjustment happening @ "kb" level. 

as added gb adjustment amount, started work correctly.

$adjustment = 80gb

thanks again


jr. admin



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file