PowerShell Examples – Random words and their popularity via Bing

This blog is part of a series that shows example PowerShell code for those learning the language. This time we’re using PowerShell to generate random words and check if they are popular by using a Bing search. The words are color-coded as white (not found on the web), green (between 1 and 1,000 hits on…


PowerShell Examples: Adventure House Game

This blog is part of a series that shows example PowerShell code for those learning the language. This time we’re using PowerShell create a text adventure game that requires to find your way out of a house using simple commands. There is a locked door and you need to find a key. This example explores…

5

PowerShell Examples: Guess the number

This blog is part of a series that shows example PowerShell code for those learning the language. This time we’re using PowerShell create a simple game where you need to guess a number. This example explores basic loops, logical operations (like –ne, –ge, –lt) and entering data with Read-Host.   ## Guess the number# [int]…


PowerShell Examples: Counting words in a text file

This blog is part of a series that shows example PowerShell code for those learning the language. This time we’re using PowerShell to count lines, count words, find the largest word and find the most frequently used words in a text file. To make it interesting, we’re using a plain text version of “Alice in…

1

PowerShell Examples: Generating Random Names

This blog is part of a series that shows example PowerShell code for those learning the language. This time we’re using PowerShell to generate random full names using common first names and common last names. It basically combines a random first name with a random letter for middle initial and a random last name. This…


PowerShell Examples: Calculating the value of Pi

This blog is part of a series that shows example PowerShell code for those learning the language. This time we’re using PowerShell to find the value of Pi. This is done using one of the many methods available, using a division between n! (factorial) and (n*2+1)! (factorial of odd numbers). This example explores loops and…


PowerShell Examples: Calculating Prime Numbers

This blog is part of a series that shows example PowerShell code for those learning the language. This time we’re using PowerShell to find prime numbers. This is not using any sophisticated method, just checking the remainder for all numbers between 2 and the square root of the number. This example explores loops and general…

1

PowerShell Examples: Calculating very small and very large numbers

This blog is part of a series that shows example PowerShell code for those learning the language. This time we’re using PowerShell to find some very small and very large floating point numbers. The principal here is that if you keep dividing a number by 2, there will be a point where the number is…


New version of the Storage Spaces physical disk validation PowerShell script

The Storage Spaces team has just published a new version of the Storage Space disk validation script written in PowerShell. This script makes sure that the physical disks in a system have everything that is needed by Storage Spaces. That includes checking functional requirements and performance characteristics. In the same way that we ask you…

2

Using PowerShell to select Physical Disks for use with Storage Spaces

  1. Introduction   If you use PowerShell to configure Storage Spaces, you probably noticed that selecting physical disks is an important part of the process. You must select disks to create a pool and you might also need to do it also when you create a virtual disk using a subset of the disks….

1