Sometimes you may want to know if your function received parameters over the pipeline or direct. Here is a way to find out: function test {...
database-tools
Categories
- Free tools
- SQL Admin Toolset
- SQL Compliance Manager
- SQL Defrag Manager
- SQL Diagnostic Manager for MySQL
- SQL Diagnostic Manager for SQL Server
- SQL Diagnostic Manager Pro
- SQL Doctor
- SQL Enterprise Job Manager
- SQL Inventory Manager
- SQL Query Tuner for SQL Server
- SQL Safe Backup
- SQL Secure
- SQL Workload Analysis for SQL Server
- Uptime Infrastructure Monitor Formerly Uptime
Chapter 6. Working with Objects
In this chapter, you will learn what objects are and how to get your hands on PowerShell objects before they get converted to simple text. Topics...
Using Background Jobs to Speed Up Things
PowerShell is single-threaded and can only do one thing at a time, but by using background jobs, you can spawn multiple PowerShell instances and...
Chapter 5. The PowerShell Pipeline
The PowerShell pipeline chains together a number of commands similar to a production assembly. So, one command hands over its result to the next,...
Validate IP Addresses
You can use regular expressions and the –match operator to validate user input. Here’s a loop that keeps asking until the user enters a...
Chapter 4. Arrays and Hashtables
Chapter 3. Variables
It is time to combine commands whenever a single PowerShell command can't solve your problem. One way of doing this is by using variables....
Chapter 2. Interactive PowerShell
PowerShell has two faces: interactivity and script automation. In this chapter, you will first learn how to work with PowerShell interactively....
Converting UNIX Time
Surprisingly, when you read some values from the Windows Registry, they do not seem to be in a readable format: $key =...
Chapter 1. The PowerShell Console
Welcome to PowerShell! This chapter will introduce you to the PowerShell console and show you how to configure it, including font colors and sizes,...
Adding Support For –WhatIf and -Confirm
Ever wanted to support the risk mitigation parameters –WhatIf and –Confirm in your functions, too? Here’s a code template that you...
Finding Disk Controller Errors
This line will analyze your system event log for disk controller errors: PS> Get-EventLog -LogName System -InstanceId 3221487627 -ea 0 |...
Adding More Fonts to PowerShell Console
Tired of using the boring default fonts in PowerShell? There are more monospaced fonts on your system. You just need to allow the console to use...
Reading Registry Values with Powershell
In a previous tip we presented the functions New-RegKey and Set-RegistryValue to you which made creating registry keys and values very easy. Here is...
Creating Registry Values
In a previous tip we introduced the new function New-RegKey that could create one or more registry keys. Here is a function that creates registry...
Creating Registry Keys
With this new function, it is simple to create new registry keys (including missing parent keys) in all registry hives. All you need are proper...
Listing Domains in Forest
Here is a function that lists all the domains in your forest: function Get-Domain{ $Root = [ADSI]"LDAP://RootDSE" try { $oForestConfig =...
Turning On Standby-Mode
To programmatically enter standby mode, you can use native .NET code like this: function Invoke-Standby { Add-Type -AssemblyName...
Correctly Returning Exit Codes
When you launch a PowerShell script from outside PowerShell, you may want to return an exit code to the caller so that the caller knows if your...
Safely Running PowerShell Scripts
If you want to run a PowerShell script from outside PowerShell, for example from within a batch file, you probably know that you need to prepend...
Adding PowerShell Goodies to Server 2008 R2
Windows Server 2008 R2 comes with a PowerShell module called ServerManager which in turn allows you to add additional features to the server....
Recording Audio Text Files
Did you know that PowerShell can record audio messages? All you need is some text. You can then turn the text into spoken language, convert it to a...
Enter Hibernation Mode
Maybe you are running lengthy tasks at night. Sometimes you may want to place the machine into hibernation once your script is done. Here’s a...
Make PowerShell Speak!
By adding a new system type called System.Speech, you can make PowerShell speak out loudly: Add-Type -AssemblyName System.Speech $synthesizer =...
Monyog Custom Counters – overcoming a problem.
In this previous Blog I described an example on how to build a Custom Object in MONyog. But there is one problem you may encounter and that is, that...
Create Group Policy Reports
Windows Server 2008 R2 comes with the GroupPolicy PowerShell module. You might have to install that feature first before you can use it – run...
Admin Privileges Enabled?
If you want to know whether your script has currently full Administrator privileges, here is an (admittedly long) one-liner that tells you:...
Locking Workstation
If you ever feel the need to lock your interactive session via PowerShell, here’s a function that can do this (and also illustrates how to use...
Logging Off
Stop-Computer and Restart-Computer can shutdown and restart a machine, but there are things they cannot do, for example logging off the current...
Check for 64-bit Environment
In PowerShell v3 (CTP2 publicly available) it is finally a snap to determine whether you are on a 64-bit machine and/or shell. PowerShell 3.0 is...