Power Tips

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

Welcome to the archive of tips delivered through Tobias' Tip of the Day RSS Feed and Your Power Tip of the Day email. Subscribe in the sidebar to get the latest tips!

Sort by: Most Recent | Most Viewed | Most Commented
  • Adding Quotes in Quotes

    If you need quotes to appear inside a quoted string, you should use quotes: $text = "Hello ""World""" $text = 'Hello ''World''' ReTweet this Tip!
  • 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 PowerShell: find "dir" * . ps1 As it turns out, the command requires the quotes, and PowerShell...
  • Create Complex Random Passwords

    Here is how you can create random passwords that meet certain requirements: function Get-RandomPassword { param ( $length = 10, $characters = 'abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ123456789!"§$%&/()=?*+#_' ) # select random...
  • 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, $characters = 'abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ123456789!"§$%&/()=?*+#_' ) # select...
  • Using MsgBox Dialogs

    Have you ever used VBScript? Would you like your MsgBox dialog back? Here is how: [ System.Reflection.Assembly ]:: LoadWithPartialName ( 'Microsoft.VisualBasic' ) | Out-Null $rv = [ Microsoft.VisualBasic.Interaction ]:: MsgBox ( 'Do you want...
  • 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 matter of only a few lines by using COM objects instead: $shell = New-Object -ComObject WScript.Shell $desktop...
  • 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 available: function Check-Online { param ( $computername ) test-connection -count 1 -ComputerName $computername...
  • 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 ( $computername ) test-connection -count 1 -ComputerName $computername -TimeToLive 5 -asJob | Wait-Job | Receive-Job...
  • 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 audit: Get-Childitem c:\ * . ps1 -Recurse -ea 0 | Get-AuthenticodeSignature | Where-Object { $_ . Status...
  • 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 in intervals, you can use this script: function Refresh-WebPages { param ( $interval = 5 ) "Refreshing...
  • 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 script collects all log files three levels deep into your Windows folder and copies them to some other folder...
  • 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 Networks," and Windows assigns to them a "public network" status. That can be bad for a...
  • 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 adapter is done by first disabling and then enabling it again. Here are three functions you can use: function...
  • 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 Get-NetworkAdapter, a function featured in another tip). Of course, you will also need Administrator privileges...
  • 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 find only those adapters that are also listed in your control panel, you should make sure to filter out...
« First ... < Previous 57 58 59 60 61 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.