![]() ![]() In past I often had this situation when one of the servers was unresponsive due to high performance which was causing service interruption. This is another great example on how to use PowerShell custom objects and add it to array. Show_menu() function shows the menu to the user which contains three options 1st for memory usage 2nd for disk usage and 3rd to exit from the program.If you would like to quickly display CPU and Memory utilization in PowerShell console then this script is for you. ![]() Step 2: Now let’s create a Menu to show a user with the required options show_menu() Now we have created memoryUsage function which gives memory usage details and diskUsage Function which gives the details about disk usage. Step 1: We are going to create two functions that check memory usage and disk usage. Now let’s move according to the above algorithm. We are going to build one script which performs two functionalities one is to check memory usage and another disk usage. Let’s see one example to understand better. Then use a while to call the show menu and take the input function until the user does not want to exit from the program.Then switch statement will call the appropriate function according to the choices. The switch statement mention all options with functions same as the show menu function. After taking input use if statement or switch statement but switch statement is good. Now we need to read the option which is entered by the user for that we need to create another function that reads the option and processes the input.For that create one function like show menu which contains all options with the function’s name. Then we need to provide the menu to the user from which the user has to select the option.First, create all functions in the script that are performed by the bash script.Let’s see the basic algorithm of the menu-driven program: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |