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...
powertips
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...
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 {...
Re-Running Your Profile
If you made changes to your profile script and want to see the changes that are in effect without having to close and restart PowerShell, you can...
Create (and Edit) your Profile Script
Profile scripts are automatically executed whenever PowerShell launches. Your profile script is the perfect place to customize your PowerShell...
Enter-PSSession – Do’s and Dont’s
Enter-PSSession will let you switch your console input to a remote computer—if remoting is enabled on the target computer. Essentially,...
Get WebClient with Proxy Authentication
If your company is using an Internet proxy, and you'd like to access Internet with a webclient object, make sure it uses the proxy and supplies...
Strongly Typed Arrays
When you assign strongly typed values to an array, the type declaration will remain intact only as long as you do not add new array content: $array...
Create Files and Folders in One Step
Use New-Item like this when you want to create a file plus all the folders necessary to host the file: new-item -type file -force...
Running 32-Bit-Code on 64-Bit Machines
Some code may not work right on 64-Bit machines. Use this approach to make PowerShell execute code in an isolated 32-Bit PowerShell session and hand...
Get Notification When a Background Job is Done
When you assign long-running commands to a background session, you may want to get some notification when the job is completed so you don't have...
Running Commands in the Background
You can also transfer commands into another PowerShell session and run it in the background. This will find all log files recursively in your...
Escaping Spaces
You should remember that spaces are special characters in PowerShell, too. They are token delimiters, and once you feed arguments to a native...
Why Native Commands Fail In PowerShell
You probably already know that not all native commands work equally well in PowerShell. Have a look here: find /I /N "dir" *.ps1 In...
Downloading Internet Files with Dialog
There is a great way to download large files from the Internet. This example downloads a tutorial video from Idera that, once downloaded will run in...
Using OpenFile Dialog
You can use this code to open a standard OpenFile dialog in your PowerShell scripts:...
Finding Methods with Specific Keywords
As such, .NET Framework is huge and full of stars, and it is not easy to discover interesting methods buried inside of it. You can use the next...
Running Programs as Different User
If you ever needed to run a program as someone else, you can use Start-Process and supply alternate credentials. When you do that, you should also...
Run Programs Elevated
If you have User Account Control (UAC) enabled, you may want to run a program elevated. That's easy using Start-Process and the -verb parameter....
Launching Programs and Keeping in Touch
Normally, when you launch a program from inside PowerShell, you will lose contact to it. However, by using Start-Process with the -passthru...
Translating Culture IDs to Country Names
Have you ever wondered what a specific culture ID means? Here is a nifty function that will translate a culture ID to the full culture name:...