Power Tips

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus


13 Free SQL Tools from Idera


Free Ebook: Mastering Powershell

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
  • Cmdlets to Manage MSI Packages

    PowerShell 2.0 and later Anyone who needs to manage MSI installer packages may benefit from an open source project found here: http://psmsi.codeplex.com/ . Simply download the PowerShell module – it comes as an MSI installer package itself. Make...
  • Reading Multiline Text

    PowerShell 3.0 and later Sometimes you will stumble across tips like the following one: $FilePath = " $env:SystemRoot\WindowsUpdate.log " $ContentsWithLinebreaks = ( Get-Content $FilePath ) -join "`r`n" Can you guess the purpose? Get...
  • Requiring Administrator Privileges

    PowerShell 4.0 and later If you know that a given script needs Administrator privileges, then a simple #requires statement is enough to make sure the requirement is met: #requires -version 4.0 #requires –runasadministrator ' I am Admin! '...
  • Analyzing and Removing Print Jobs

    Windows 8.1 or Server 2012 R2 Both Windows 8.1 and Server 2012 R2 come with a module called “PrintManagement”. It includes all cmdlets needed to manage local and remote printers. In a previous tip we illustrated how to read print jobs. Each...
  • Listing All Print Jobs

    Windows 8.1 or Server 2012 R2 Both Windows 8.1 and Server 2012 R2 come with a module called “PrintManagement”. It includes all cmdlets needed to manage local and remote printers. To list all print jobs on a given computer, first determine...
  • Remotely Updating Group Policy

    Windows 8.1 or Server 2012 R2 To update Group Policy settings on a remote machine, use Invoke-GPUpdate, and submit the name of the computer where you want the update to occur. Invoke-GPUpdate schedules the command “gpupdate” on the remote...
  • Managing Printers

    Windows 8.1 or Server 2012 R2 Both Windows 8.1 and Server 2012 R2 come with a module called “PrintManagement”. It includes all cmdlets needed to manage local and remote printers. Here is a sample script that installs a printer driver and a...
  • Simplifying .NET Types

    All PowerShell versions PowerShell uses short names for the most common .NET types. To see if there is a short name for a .NET type you are using, try this: PS> [System.Management.Automation.LanguagePrimitives]::ConvertTypeNameToPSTypeName("System...
  • Converting Code to Uppercase

    PowerShell ISE 3.0 and later To turn PowerShell code to all uppercase letters in PowerShell ISE, select the text, then press CTRL+SHIFT+U. To turn text to all lowercase letters, press CTRL+U. ReTweet this Tip!
  • Mapping Drives

    PowerShell Version 3 and later To permanently map a network drive, use New-PSDrive with the –Persist parameter. This parameter makes the drive visible outside PowerShell. To really create a persistent network drive, also make sure you add –Scope...
  • Using System Error Colors for Output

    All Versions If your script wants to output warnings or error messages, you can use Write-Warning or Write-Error. Both cmdlets will use the default PowerShell colors for warnings and errors. However, the cmdlets will also apply a text template to your...
  • Resolving IP Addresses (and Parameter Types, Too)

    PowerShell 2.0 and later Here is a function that illustrates two things: it shows how you can limit a parameter to a given data type, and it shows how you can use a .NET method to turn IP addresses into machine names: function Resolve-IPAddress { param...
  • Conditional Breakpoints

    PowerShell 3.0 and later The PowerShell ISE supports line breakpoints only: they make the code stop once the debugger hits that particular line. You can toggle line breakpoints in the PowerShell ISE by pressing F9. Just make sure the script is saved....
  • Detecting 64-bit Operating System

    Windows 7/Server 2008 R2 To detect whether a script runs in a 32-bit or 64-bit environment is fairly easy: check a pointer size, and test whether it is 4 or 8 bytes: if ([ IntPtr ] :: Size -eq 8 ) { ' 64-bit ' } else { ' 32-bit ' } This...
  • Creating NTFS Security Report

    All PowerShell Versions If you'd like to audit NTFS permissions on your file servers, here is a suggestion how you could start. This script scans the Windows folder recursively for subfolders. Simply replace $Path with another path to scan other areas...
« First ... < Previous 2 3 4 5 6 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.