You will find that one great advantage of 64bit-Environments is the address width of 8 bytes instead of 4 bytes. You can use this to identify...
database-tools
Finding Maximum Values
Numeric types can store numbers in certain ranges. A byte for example stores values in the range 0-255. But do you know just what the range is for...
Monitoring Disk Space Of Nas Devices
I have 3 different NAS devices (Netgear, Lacie, IOmega) that I would like to monitor through uptime to see if their disk space is being used or...
Finding Days in Month
If you need to determine the days in a given month, you can use the static DaysInMonth() function provided by the DateTime type. As you can see, the...
Finding Leap Years
You will find that the DateTime type supports a number of static methods to check dates. For example, you can check whether a year is a leap year...
Getting Short Dates
Objects contain useful methods to access the object data. For example, DateTime objects support methods to display the date and time in various...
Getting Alphabetical Listings
Unfortunately, PowerShells special ".." operator only supports numeric ranges: 1..10 You can use type conversion to get a range of...
Counting Special Characters
Type conversion can help you count special characters in a text. For example, if you'd like to find out the number of tab characters in a text,...
Chaining Type Conversions
In PowerShell, you can do multiple sequential type conversions. For example, you should first convert the string into a character array and then...
Accessing Event Logs via Conversion
You will find that type conversion can do amazing things. For example, the next line accesses a system log by converting the log name to an EventLog...
Finding WMI Instance Path Names
In a previous tip, you learned about how to access WMI instances directly using their individual instance path. Here is how you can find that path...
Accessing WMI Instances Directly
If you know the path to a WMI instance, you can access it directly by converting the WMI path to a WMI object:...
Type Accelerators
PowerShell has a few shortcuts for popular .NET types like [WMI], [ADSI] or [Int]. You should read the FullName property if you'd like to know...
Comparing Versions
When you compare version strings, PowerShell will use alphanumeric algorithms, which may lead to confusing results: '3.4.22.12' -gt...
View Object Inheritance
A hidden object property called "PSTypeNames" will tell you the object type as well as the inherited chain: (Get-WMIObject...
Using Scripts to Validate Input
For tricky validation checks, you should use arbitrary PowerShell code to validate. The function Copy-OldFiles will only accept files (no folders)...
Restrict Input to Numeric Ranges
Let's say you'd like to set the PowerShell console cursor size. This size must be a number between 0 and 100. The following template will...
Converting Object Types
Once you know the name of an object type, you can use that type for conversion. The next line converts a string into a date-time type: [DateTime]...
Finding Object Types with Powershell
Anything in PowerShell is an object. You can use GetType() to get the object type:...
Validate Input Using Regular Expressions
Function parameters can be validated using standard regular expressions. For example, the next template function accepts only valid Knowledge Base...
Limiting String Input Length
If a function parameter should receive a string of a given length only, you should use the following validation attribute. In the example, it limits...
Limiting Number of Arguments
Function parameters can receive multiple values when they accept arrays. You should use this template to limit the number of values acceptable:...
Defining Alias Properties
Your functions can have properties with built-in alias names. The user can then either use the descriptive "long" name or its short and...
Validate Set of Inputs
If you need to limit a function parameter to only a set of allowed choices, you should use the next example: function Get-24hEventLogEntries...