Here is a safe way of saving credentials to a file: $CredPath = "$home\Desktop\mycred.xml" Get-Credential | Export-Clixml -Path $CredPath...
database-tools
Clearing the Recycle Bin
A much awaited new cmdlet surfaced in PowerShell 5.0: Clear-RecycleBin! You can clear the recycle bin on a particular drive, or on all drives. This...
Launching PowerShell with Admin Privileges – Always
When you launch PowerShell, you should right-click the PowerShell icon in the taskbar and pin it to the taskbar. This way it is always visible, and...
ValidateSet Instead of Enum
In the previous tip we illustrated how the new "enum" keyword works in PowerShell 5.0 to set the values that are assignable to a...
Using Enumerations
Beginning with PowerShell 5.0, you can use the new keyword "enum" to create enumerations. They can be useful for parameter validation:...
SQL Server 2016 Has a Little Something for Everyone
This Thursday, June 23, IDERA is sponsoring a virtual Windows IT Pro event to discuss what’s new with SQL Server 2016 — which was released on June...
Remotely Executing Applications on Behalf of Someone Else
When you remotely execute an application, it will run invisibly on the remote system. Here is some code that illustrates how you can run an...
Changing Excel Cells from PowerShell
If you need to change the content of a specific cell in an Excel spreadsheet, take a look at this sample code: $ExcelPath =...
Reading Excel Cells
The fastest way to read data from an Excel spreadsheet is to export the data to CSV, then use Import-CSV. However, sometimes the data in an Excel...
Minimizing All Windows (Part 2)
If all you need to do is minimizing all open windows, there is the Shell.Application COM object. PowerShell can access its methods via New-Object:...
Minimizing All Application Windows
In a previous tip we explained how PowerShell can access low level API functions such as ShowWindowAsync(). Once you better understand how a...
What did our #SQLChat teach us about Execution Plans?
IDERA hosted its monthly live Twitter Chat on Wednesday, June 8 at Noon (CT) with Thomas LeBlanc (@TheSmilingDBA). Tips, techniques and resources...
Accessing API Methods
PowerShell can use C# to define new .NET types that access the internal Windows API methods. Here is some code that makes accessible the...
Check Default PowerShell Module Paths
Sometimes, PowerShell modules ship as MSI packages. When they do, you never know what the installation logic does to your system. Unfortunately,...
PSGet is Evil!
If you have played with the early releases of PowerShellGet and the PowerShell Gallery (www.powershellgallery.com), you may still have a module...
Where’s Your Duck Going This Summer?
Do you have any special summer plans? Share them with IDERA and you could win big! Take your favorite IDERA duck with you on your upcoming summer...
Converting 8.3 File Names
If you want to convert a short 8.3 filename to its long file name, try something like this: PS> (Get-Item...
Use PowerShell 5.0 Code Generation API
In PowerShell 5.0, a new .NET type was introduced that can help you escape text information so it can be displayed correctly: PS>...
Cleaning Week: Removing Traces (Recents)
Cleaning week comes to an end. As a last part, you may want to check the list of files you recently opened. This list is full of privacy sensitive...
Cleaning Week: Getting Rid of Downloads
Do you really need all the files you downloaded in Windows? It may pay off to look at the downloads, and delete downloaded files you no longer need....
Cleaning Week: Deleting CBS Log File
Windows maintains a log file named cbs.log in $env:windir\logs\cbs. It logs various pieces of information related to the Windows trusted installer,...
Cleaning Week: Deleting Log File Backups
In a previous tip you learned that there may be gigabytes worth of log file CAB files. Today, let’s try and have PowerShell do the cleanup....
Cleaning Week: Finding Fat Log File Backups
When you run a Windows box for a couple of months or even years, a lot of disk space can be wasted by backed up log files that are not needed. So if...
Cleaning Week: Deleting TEMP Files
In a previous tip you learned how to check for left-over files in both your own temp folder and the one maintained by Windows. Today, let’s...