If you would like to programmatically control page file settings, you can use WMI but must enable all privileges using -EnableAllPrivileges. The...
database-tools
Eliminating Duplicate Words
Let's assume you want to eliminate duplicate words in a text. Here is how you can do this: 'this text text contains duplicate words words...
Add Whitespace after Commas
Operator replace is extremely powerful when you use back references. For example, to make sure in a text that there is a space after each comma, you...
Use Back References with -Replace
If you need to replace text with some other text and keep a reference to the original text, you can use the backreferenceback reference placeholder...
Adding Quotes in Quotes
If you need quotes to appear inside a quoted string, you should use quotes: $text = "Hello ""World"""$text =...
Running Native Commands in PowerShell
Sometimes it only takes a little tweaking to make a native command run well inside PowerShell. For example, this line runs in cmd.exe but fails in...
Create Complex Random Passwords
Here is how you can create random passwords that meet certain requirements: function Get-RandomPassword { param( $length = 10, $characters =...
Create Random Passwords
Whenever you need to create a new random password, be sure to check out this function: function Get-RandomPassword { param( $length = 10,...
Using MsgBox Dialogs
Have you ever used VBScript? Would you like your MsgBox dialog back? Here is how:...
Creating Shortcuts on your Desktop
PowerShell and .NET can do amazing things, but they are not good at creating shortcuts. However, you can create a shortcut on your Desktop in a...
Resolving Host Names
In a previous tip, you learned how to quickly ping network segments. Next, you could resolve online IPs and get host lists of systems currently...
Finding Systems Online (Fast)
Using PowerShell Background Jobs, you can find a large number of online systems within only a few seconds: function Check-Online { param(...
Auditing PowerShell Scripts
How would you know if all PowerShell scripts on a production critical server are safe? Here is a simple line that can help you conduct a security...
Refreshing Web Pages
Imagine you opened a number of Web pages in Internet Explorer and would like to keep the display current. Instead of manually reloading these pages...
Using Robocopy to Copy Stuff
You should avoid cmdlets if you need to copy large files or a large number of files. Instead, you should use native commands like robocopy. This...
Hiding NetworkAdapter
When you use VMware, or if you have installed a Microsoft Loopback adapter, these adapters will show up in your network panel as "Unidentified...
Resetting Network Adapters
Sometimes, it is necessary to reset network adapters, such as after you changed settings for that adapter in your registry. Resetting a network...
Disabling Network Adapters
If you need to systematically disable network adapters, all you need is the name of the adapter (as stated in your control panel or returned by...
Enumerating Network Adapters
Finding your network adapters with WMI isn't always easy because WMI treats a lot of "network-like" adapters like network adapters. To...
Launching PowerShell Scripts with Admin Privileges
If you must ensure that a PowerShell script runs with Admin privileges, you can add this to the beginning of your script: $identity =...
Test Admin Privileges
If you want to systematically test whether you currently have Administrator privileges, you can use this function: function Test-Admin { $identity =...
Processing Function Parameters As Hash Table
If you want to get more control over function parameters, you can treat them as hash table. So in your function, you can then check whether a...
Customization of monitors & advisors become more easy with the latest MONyog 4.1
The highlights of this release are: * A brand new helper function interface: We have implemented an easy-form based interface for customizing helper...
Determining Function Parameters Supplied by User
To find out which parameters that a user submitted to a self-defined function, you can use $PSCmdlet like this: function Get-Parameters {...