Code Check for Disk Freespace

Hello, 
I have a very basic Powershell command string working, but when I execute it I get an error that says "Attempted to divide by zero".  When doing the math I am not attempting to divide by zero, so even though the commands work, I was wondering
if anyone could explain to me why that error pops up. 
Thank you!
Get-WmiObject win32_logicaldisk | where-object {$_.Freespace -ge ((($_.freespace/$_.size) * 100)
) -and $_.drivetype -eq 3}

Hello jrv, 
Actually, the arithmetic does work.  The problem is that I was trying to filter the drivetype in the where-object instead of with the filter as you suggested.  As soon as I switched that around my where-object and my formula worked just fine. I
don't appreciate your snide and unnecessary comment at the end about skipping class in the second grade and if I could report it as abuse I would.  I am trying to learn powershell as a beginner and people like you make asking questions difficult. 
How about you try helping others instead of putting them down?
As I poited out - elementarty school arithmetic.  The math does NOT work in any kind of usefule fashion.
Look closely at the numbers and you will see what I mean.
(($_.freespace/$_.size) * 100)
This is always 100 time the freespace reading,  T^hat makes "Fre4esapce equal to 1/100 of this number or 1%.
$_.Freespace -ge ((($_.freespace/$_.size) * 10o
if freespace is 10 and size is 100 then the numerbs are (10 -ge  ((10/100) * 100)
Factor out10.
(1 -ge  ((1/10) * 10)
1/10 * 10 will always be 1.
You are in eff3ect saying is 1 greater than or equal to 1 which will always be true.
The test is pointless and does not check for a freespace threshold.
We want here to see the percentage of free space.  Percentage is a ration of two numbers.
Freespace/Size is a ration (third grade arithmetic - if I have three cookies and I give one to you what fr4action did I keep?
if freespace ia1 25 GB and Size is 250Gb then the ratio p(unnormalized percentage) is 23/250 or 1/10 or .10000000 TO kae this a human percentage with a % sign we multiply by 100. .1 * 100 is .... 10 and then add the sign for 10&.
The frespace (%) for a dis is (freesapce/size) * 100 if expressed as a percent.
?{($_.freespace/$_.size * 100 -lt 10}
This would filter out and show all drive that have less than 10% freespace.
It is easier to just say this:
?{($_.freespace/$_.size -lt .1}
Since the ratio will alwys be a number less than '1'.
Too many techs including many with college degrees get this wrong because they forgot what they learned bout apples and pies in elementary school.
Don't feel bad. You are in good company.  Most of Congress cannot add or do ratios either.
¯\_(ツ)_/¯

Similar Messages

  • Workshop 6u1 installation freezes when checking for disk space

    Hi!
    I've trying to install Workshop 6 update 1 but while installing and the application is checking for disk space it just freezes on me. One important thing, this system had Workshop 4, 6u1 and 6u2 installed. I removed the package for ws4 and untinstalled ws6u1 and ws6u2 from /var/sadm/prod/com.forte....... for each one of the versions.
    Do you have any idea what is going on, why it freezes when checking for disk space???
    thanks,
    Jorge

    Hi,
    command: cmd.exe /c D:\oracle e-business suite R12\oracle ebusiness suite\startCD\Disk1\rapidwiz\bin\adchkutl.cmd C:\cygwin C:\msvc
    'D:\oracle' is not recognized as an internal or external command,
    operable program or batch file.
    RW-50011: Error: - System Utilities Availability test has returned an error: 1Please do not use spaces in directory names, spaces are not allowed and it is expected to get such errors because of the spaces.
    Host/Domain
    command: ping -n 1 windows7-pc
    Pinging WINDOWS7-PC [fe80::4c7b:9a58:f4b2:e7c5%12] with 32 bytes of data:Please note that Windows 7 is not certified as a database/application tier node.
    Thanks,
    Hussein

  • Solution to switch off Postal code checks for countries Denmark and Norway

    Client wants to switch off this functionality as the Postal codes in SAP are not updated.
    The user should not have any difficulty in keying Postal codes and the City. The system should not check and must save the entries typed by the user
    What are the possible ways of doing this? please help
    Thanks
    Jegadish

    Thanks. OY17 for Denmark and Norway is unchecked already
    There should definitely be a way in SAP to allow the user to enter the postal code and city
    V_005_B is already unchecked
    for denmark , sytem picks up postal code from Table -T5M8T.. how do I control the sytem not to check this table?
    any help would be highly appreciated
    Thanks
    Jegadish
    Edited by: J Jegadish on Feb 21, 2010 12:01 PM

  • Checking for disks

    Is there a way to use a Java program to see whether there is a disk in a specific CD-rom or other media drive?

    You can find the CS4 download here: https://helpx.adobe.com/creative-suite/kb/cs4-product-downloads.html
    Benjamin

  • How to check for physical damage on a disk using the Command Line

    I have a startup disk that I suspect of physical damage. The symptoms is that the server (10.4.7) would "hang" randomly, about once a day. I have already changed it and restored from a backup, and now everything is fine. However just out of curiosity are there any command line utilities to do a physical surface scan of the drive, like TechTool Pro but included in Mac OS X Tiger?
    G4 Dual 1.42 Ghz   Mac OS X (10.4.6)  

    Extract from the Command Line Guide for Tiger Server:
    Checking for Disk Problems
    You can use the diskutil or fsck command (fsck_hfs for HFS volumes) to check the physical condition and file system integrity of a volume. For more information, see the related man pages.
    MacBook Pro   Mac OS X (10.4.7)  

  • Deactive post code check in sales order

    Hi all
      We have one customer ,but  this customer need us change ship-to-party  address and postal code in sales order header().
    but our system  will check the country code and postal code.
    How can I deactive post code check in  sales order ???
    thanks

    Hi,
    Postal code checking for country is a global setting in SAP, and many settings are depends upon it. But if you still want to change it you can modify it at country level.
    Go to SPRO >> SAP Netweaver >> General Settings  >>  Set Countries  >>  Set-Country sepcific checks   here select the country and modify it as you want.
    but still i ll advice you to do not change these settings as it will affect as client level.
    better you change Customer master address data as client wants and re enter re enter the customer code in sales order.
    Regards,

  • ZIP code format for each country in SAP

    Please provide me the way to retrieve ZIP code format for each country in SAP.....

    Well Yash
    You might have noticed the checking rules in the same place. They are the ones which is used for checking formats. I don't know which internal table  (I doubt if there is one) holds the format data per country.  There are formal format checks for few specific countries like Canada, the Netherlands, Poland, Sweden, Slovakia, the Czech Republic, South Korea, and Portugal and I guess they are hardcoded.  Another thought is that Regional Structure Group related tables may hold this.
    If you have ABAPer by your side, check out Function module POSTAL_CODE_CHECK which is used in conjunction with the checking rules mentioned. This may provide you some clues.
    I am wondering why you need this info.
    If you need to set up your own config in Address Management than what is supplied in the standard,  then use the following path:
    SPRO/IMG/SAP NetWeaver/Application Server/Basis Services/Address Management
    Also go through the following OSS notes:
    1123588 - Postal code check for different countries
    1381564 - Postal codes

  • LabVIEW DSC 8.0 examples that deal with events check for valid timestamp.Why?

    Hi folks !
    There are examples that come with LabVIEW DSC 8.0 that deal with alarm events, In these examples - DSC Alarms Event Structure Support.vi contained in DSC Alarms Demo.lvproj, for instance - when an alarm event occurs, the code checks for a valid time stamp - 17:00:00.000 31/12/1975. I´m confused, can anyone help me understanding why it´s done?
    Thanks !

    Hello marc8470,
    Each Virtex 5 FPGA bank requires an external voltage reference.  The FlexRIO FPGA module provides this reference in the form of Vccoa and Vccob.  Because there are two voltage references available on the FlexRIO FPGA module, each Vcco reference is connected to 2 IO banks.  The Adapter Module Interface and Protocol chapter of the FlexRIO MDK manual has a table that indicates which GPIO banks are referenced to which Vcco reference.  The Vcco levels set in the general section of the adapter module configuration file are not used by the Xilinx compiler, but instead by the fixed FlexRIO logic to configure the external voltage references.  The IO standard constraints section of the adapter module configuration file is used during compile to configure the output drivers in the Virtex 5.  If the general VccoALevel and VccoBLevel values do not match the IO standard constraints, no error will occur during compile, but the hardware will not be configured correctly during runtime.  The logic families used by each general purpose IO (GPIO) line must match that of the Vcco levels set in the general section of the adapter module configuration file.  A mismatch in values could result to incorrect behavior or possible damage to the FlexRIO FPGA module or the adapter module. 
    In the future, please use the email address included in your NI FlexRIO Adapter Module Development Kit (MDK) User Manual to send your questions directly to the FlexRIO MDK support team.  This group has experience with specific FlexRIO MDK questions such as this one. 
    The FlexRIO MDK manual is designed to provide all of the information a hardware designer will need to create a FlexRIO adapter module.  National Instruments is always improving and working on new releases of the FlexRIO MDK.  Please feel free to use the support email address in the FlexRIO MDK manual to send me any feedback you have on the contents of the manual.
    Regards,
    Browning G
    FlexRIO R&D

  • HTTP Return Code Checking on ACE

    Hey there.
    I have a question regarding return code checking for a serverfarm on ACE. I am looking to have the ability to monitor a client's session real-time and monitor return codes passing back from the origin servers to the client.
    For example, if during a client's session there is a single HTTP 500 error code sent from server to client, the intercept that response and first retry the request on a different server in the farm. Or perhaps only if I see three 500 error codes in 30 seconds. Something like that.
    From what I can tell from the docs the retcode check command for a serverfarm is maybe only for statistical purposes?
    Thanks for any help.
    /ahuffer/

    In ACE return codes checking is only used to count number of return codes from Rservers. Unlike CSMs (where return codes were used for inband health monitoring) ACE is not using them for load balancing or inband health
    monitoring. Once you enable return code checking and counting you can then display the return code statistics per serverfarm
    for example
    serverfarm host serverfarm1
    retcode 200 499 check count
    rserver real1
    inservice
    rserver real2
    inservice
    show serverfarm serverfarm1 retcode
    serverfarm : serverfarm1
    rserver : real1
    np : 1
    return code action total count
    +------------+--------+------------+
    200 count 100
    201 count 0
    202 count 0
    203 count 0
    204 count 0
    205 count 0
    206 count 0
    498 count 0
    499 count 0
    Syed

  • I didnt konw how to make a new account for my iTues card so i did it with a diffrent email but that email doesnt exist and when i tried to make it on a real email i just sai invalid code check the code and try again and can u please help me

    please help me it is a card of 25 dollars and i dont want it to go to waist i by mistake thought you used a frake email so i made one up i thought i was going to have a new one but then it said it was going to send a verifaction to my email so then i tried to use a real email and put in the code but it just kept on saying invalid code. check the code and try again. and i dont know what to do can u please please help me it was a gift and i really dont want it to go to waist please i need help

    for #1
    Frequently asked questions about Apple ID - Apple Support
    I have multiple Apple IDs. Is there a way for me to merge them into a single Apple ID?
    Apple IDs cannot be merged. You should use your preferred Apple ID from now on, but you can still access your purchased items such as music, movies, or software using your other Apple IDs.
    If you are wondering how using multiple Apple IDs relate to iCloud, see Apple IDs and iCloud.
    for #2
    Apple does not accept unsolicited ideas see Apple - Legal - Unsolicited Idea Submission Policy

  • AP - One Check for Vendor from two Company Codes

    Our Company would like to issue one check  for a vendor in two company codes.
    Configuration has the paying company code = sending company code.
    So the payment proposal will want to create two checks, one for each company code.
    Question --- Is there a way to generate one check for the one vendor in two company codes.
    Thank you,
    Jeffrey

    Dear Jeffrey,
    Let say there are two company codes 100 and 200, in the config, you will need to make paying company code for company code 100 = 100 and
    Paying company code for company code 200 = 100.
    you will need to set the Intercompany balancing account in Tcode OBYA.
    Once you do this, the other process remains the same. Should you have questions, let me know.
    Thanks
    Raghuram

  • Hello Mac heads.! I just downloaded Onyx for tiger.  All went well.  But I try to launch onyx from my applications and it doesn't offer checking the S.M.A.R.T. status so I can check my disk.  Everything else appears.  Uninstall only, forums, website etc.

    Hello Mac heads.! I just downloaded Onyx for tiger.  All went well.  But I try to launch onyx from my applications and it doesn't offer checking the S.M.A.R.T. status so I can check my disk.  Everything else appears.  Uninstall only, forums, website etc.

    I think you should get Applejack...
    http://www.macupdate.com/info.php/id/15667/applejack
    After installing, reboot holding down CMD+s, (+s), then when the DOS like prompt shows, type in...
    applejack AUTO
    Then let it do all 6 of it's things.
    At least it'll eliminate some questions if it doesn't fix it.
    The 6 things it does are...
    Correct any Disk problems.
    Repair Permissions.
    Clear out Cache Files.
    Repair/check several plist files.
    Dump the VM files for a fresh start.
    Trash old Log files.
    First reboot will be slower, sometimes 2 or 3 restarts will be required for full benefit... my guess is files relying upon other files relying upon other files! :-)
    Disconnect the USB cable from any Uninterruptible Power Supply so the system doesn't shut down in the middle of the process.

  • Authority Check at the T.Code level for the user in particular User Group

    Hi Friends,
    I have created a ZREPORT and assigned this report to a ZTRANSACTION CODE.
    Need to give Authority Check at the T.Code level for the user in particular User Group.
    I have searched in SCN, but not get suitable pages.
    How to solve this?
    Regards,
    Viji.

    Hi Viji.
    Saha way is actual way for authority tcode but user authority in TCODE:- SE38 he/she can run report(ZREPORT) wise program is run is no authority check.
    Another way is you have also check authority in program level.
    DATA: T_ROLE_USERS TYPE STR_AGRS OCCURS 0 WITH HEADER LINE.
       INITIALIZATION.
      CALL FUNCTION 'ESS_USERS_OF_ROLE_GET'
        EXPORTING
          ROLE       = 'ZROLE''  " Role define
        TABLES
          ROLE_USERS = T_ROLE_USERS.
      READ TABLE T_ROLE_USERS WITH KEY UNAME = SY-UNAME.
       IF SY-SUBRC NE 0.
       RETURN.
       ENDIF.
    Thanks & Regards
    Rahul

  • Optical Drive keeps checking for a disk every 5mins

    MBP 15" - My optical drive keeps spinning up as if is checking for or reading a disk. There is not one in there. It doesn't seem to be causing any problems, it's just annoying.

    dseibold wrote:
    MBP 15" - My optical drive keeps spinning up as if is checking for or reading a disk. There is not one in there. It doesn't seem to be causing any problems, it's just annoying.
    I was going to begin my own thread about this but I'm glad you've begun one already.
    I'm having the same issue as you are and it's quite annoying. It's not only annoying but it makes me worry about the longevity of the motor in the optical drive.
    A bit of history -- after my LCD backlight died on my original 2.0GHz MacBook Pro and after 3 repair attempts (all gloriously FAILED) by the Apple Store on Regent Street here in London (flagship store my eye!) it was decided that rather than attempt more repairs Apple would replace the machine. As Apple would only guarantee they'd meet the specs of my previous machine I was given a stock 2.4GHz unibody MBP. I received that machine 4 days ago, Thursday of last week. Out of the box it was exhibiting the phantom disc issues you describe, roughly every 5 minutes. The only time it wasn't making the noise was when I had a disc in the drive.
    Assuming it to be a defective optical drive I booked a Genius appointment and the earliest I could get was earlier today. I took the old machine in and between the issue I described with the new machine and the recent repair debacle they decided to swap the new computer for another new one on the spot (which was good as I would have asked for that to happen had they not brought it up). For interest's sake, that first unibody machine also had 2 dead pixels.
    Fast forward to when I get back to the flat and unpack the second replacement unit today only to find that after I restore from my Time Machine backup the optical drive is doing the SAME THING again. The new unit also has 3 dead pixels. I will be taking this machine straight back to Apple tomorrow to ask *** is going on and get some satisfaction.
    One thing I did find, after some investigation, is that when the optical drive does its phantom ejection, there's a process started. If you watch Activity Monitor (sort by process ID, newest first) you'll see DiskManagementTool kick in when the noise is made. That's a component of Disk Utility however thus far I've not discovered what triggers it or why; however, I wonder if it's anything to do with some component that was on my original MBP that was archived via Time Machine migrated to the new unit. Because I've neither done a clean OS reinstall nor waited past the migration assistant to restore my data, I'm not sure if the drive makes the noise when my backup's not in use but I have this nasty feeling it wouldn't.
    Anyone else having this issue, please launch Activity Monitor and keep an eye on it to see if the same process kicks in when the optical drive makes its noise. I suspect others will see that happen, meaning that's the first step in figuring out a solution. It really seems like it's a software issue so it should be fixable.

  • RE: Abap Code Flow for Multiple Authorization checks

    Hi all,
    I am basically a security person, but i have some doubts on Authority-check in ABAP code. so i thought this is best place to understand the execution of ABAP code.
    Q1. I know that ABAP programmers will put Authority check in ABAP code and when program was executed Authority-check will compare whether user has access to this object or not.
    for EX take some tcode ZXYY
    i activated 3 objects out of some 20 objects for this tcode in SU24.
    Authority checks are placed in the program.
    when this tcode was executed and started the ABAP code, then i think it will do the authority check for the first object and if user has the profile to it then it will go for the second authority-check for which if user does not had profile ( i made inactive in role)  will the code terminate  and throw some error there it self or will it go for the for 3rd object for which again user has access. (user got access to this 3rd object)
    can any explain?
    Q2. Should the activities be same as in Authority-check.
    I mean in Authority check if you give activities 02 and 03  and in user profile if i give only 02 will it work or not?
    thanks,
    Sun

    Refer Below Code:
    IF SY-TCODE = 'CJ40'.
         AUTHORITY-CHECK OBJECT 'ZPS_VERSN'    "'ZWMM_WERK'
            ID 'VERSN' FIELD bpdy-VERSN
            ID 'ACTVT' FIELD '01'
            ID 'ACTVT' FIELD '02'
            ID 'ACTVT' FIELD '03' .
           IF SY-SUBRC = 0.
    *        continue.
           elseif SY-SUBRC <> 0.
             AUTHORITY-CHECK OBJECT 'ZPS_VERSN'    "'ZWMM_WERK'
               ID 'VERSN' FIELD bpdy-VERSN
               ID 'ACTVT' FIELD '01'.
               IF sy-subrc = 0.
    *            CONTINUE.
               ELSEIF sy-subrc <> 0.
                  AUTHORITY-CHECK OBJECT 'ZPS_VERSN'    "'ZWMM_WERK'
                   ID 'VERSN' FIELD bpdy-VERSN
                   ID 'ACTVT' FIELD '02'.
                   IF sy-subrc eq 0 .
    *                CONTINUE.
                   ELSEIF sy-subrc <> 0 .
                     AUTHORITY-CHECK OBJECT 'ZPS_VERSN'    "'ZWMM_WERK'
                      ID 'VERSN' FIELD bpdy-VERSN
                      ID 'ACTVT' FIELD '03'.
                      IF sy-subrc = 0.
                        versn = bpdy-versn.
                        v_proj = proj-pspid.
                        wbs = PRPS-POSID.
                        set PARAMETER ID 'PSP' FIELD  v_proj.
                        set PARAMETER ID 'BP2' FIELD  VERSN.
                        set PARAMETER ID 'PRO' FIELD  wbs.
                        LEAVE TO TRANSACTION 'CJ41' AND SKIP FIRST SCREEN.
                      ELSEIF sy-subrc ne 0.
                        MESSAGE 'You are not authorised for this version.' TYPE 'E'.
                      ENDIF.
                   ENDIF.
               ENDIF.
             ENDIF.
       ENDIF.

Maybe you are looking for

  • Error while putting message in weblogic queue

    Hi Am having a bpel process which connects to weblogic queues using JMS Adapter and places XML content into the queue. I have imported the XSD too while creating the adapter. What i have observed is when i send a bulk of messages to be put in the que

  • Using CS3 illustrator with OS X 10.10.1

    I am running OS X 10.10.1 and my CS3 Illustrator is not working properly. I have uninstalled just the Illustrator segment. I have used MacKeeper to clean up any leftovers, and done a clean reinstall. Now all the app will do is start up, but not fully

  • Internet stops working on new wrt56gs router

    Greetings Helpful, I recently installed a new Linksys WRT56GS router on my work network, but it drops the internet connection from time to time.  Unplugging the router fixes the issue temporarily, but I would love a more permanent fix. Here are some

  • Adobe acrobat professional Features

    I am planning on buying Adobe professional but want to ensure there is a particular feature I need. My plan is to have a simple web site to control the distribution of printed material in pdf format.  What I want is to control the life span of the do

  • DNG icon issues for Bridge

    Recently, some of my folders in Bridge CS3 have had images replaced by DNG icons.  Other folders still okay.  Not sure how to go about getting things back to images in folders like before.  Not a techie, so need really clear guidance!  Thanks!