You can enable the -WhatIf and -Confirm parameters in your functions too, and control which parts of your code get skipped if the user specifies...
database-tools
Finding Enumeration Data Types
In a previous tip you learned that assigning an enumeration data type to a function parameter automatically enables argument completion in...
Using Enumeration Types for Parameter IntelliSense
In a previous tip you learned how decorating function parameters with a ValidateSet attribute would allow the ISE editor to display intelliSense...
Rich IntelliSense for Function Arguments
To take advantage of the new PowerShell 3.0 argument completion, make sure you're adding ValidateSet attribute to your function parameters...
Get-WmiObject Becomes Obsolete
In PowerShell 3.0, while you still can use the powerful Get-WmiObject cmdlet, it is slowly becoming replaced by the family of CIM cmdlets. If you...
Finding Built-In Cmdlets
In times where cmdlets can originate from all kinds of modules, it sometimes becomes important to find out which cmdlets are truly built into...
Providing "Static" IntelliSense for Your Functions
To get rich IntelliSense in PowerShell ISE 3.0, you should start adding the OutputType attribute to your functions. If you do, then ISE is able to...
Detecting STA-Mode
Here is a simple line that tells you whether PowerShell runs in MTA- or STA-mode: [Runspace]::DefaultRunspace.ApartmentState -eq 'STA' This...
Finding IP Address
There are various ways to determine the IP address that is assigned to your machine. Here is a rather unusual approach that uses text operators to...
Finding Object Properties in Powershell
Sometimes, you know the information you are after is present in some object property, but there are so many properties that it is a hassle to search...
Preserving Special Characters in Excel-generated CSV files
When you save Excel spreadsheets to a CSV file, special characters get lost. That's because Excel is saving the CSV file using very simple ANSI...
Change Order of CSV Columns
If you have a CSV file and would like to change the order of columns, simply import it into PowerShell, use Select-Object to change the order, and...
Why isn’t there a Procedure Editor for Sybase ASE like there is for the other database vendors?
I can right mouse click on a procedure in Oracle, DB2 and SQL Server and choose the "Edit in Procedure Editor", but in Sybase ASE this option...
Can we export data from Oracle using UTL_FILE or the SPOOL command?
How can we do this? Response Niels Gron over 10 years ago You can accomplish this functionality in Aqua Data Studio with the same or similar...
DB2 iSeries SQL and System Naming
I have a question about using "system" naming with the iSeries driver. Usually this allows you to provided a list of schemas that may contain your...
Why does Table Data Editor ask me to disambiguate column names?
When I enter a query into ADS which contains a join and the tables have common column names, the database server will not execute the query if the...
Find Open Files
To find open files on a remote system, use openfiles.exe and convert the results to rich objects. Here is a sample (replace "storage1"...
Creating Custom Objects in Powershell
If you want to create your own custom objects, for example, to enable your functions to return rich objects, you can always use Select-Object like...
New Operators in PowerShell v3
There are four new operators in PowerShell v3: -shl: shifts bits to the left -shr: shifts bits to right and preserves sign for signed values -in:...
Validation Attributes On Variables
In PowerShell v2, function parameters could be decorated with validation attributes. In PowerShell v3, these attributes can now also be applied to...
Line Breaks After "." and "::"
In PowerShell v3 language syntax, it is finally allowed to have line breaks after "." and "::". These symbols are used to access...
Executing Code Locally and Remotely Using Local Variables
Here is a piece of code that illustrates some of the challenges when writing remotable code: function Get-Log($LogName='System',...
Using Local Variables Remotely
If you want to send a script block to a remote computer, it is important to understand that the script block is evaluated on the remote computer. So...
Firewall Problems When Enabling Remoting
Enabling PowerShell Remoting is a simple thing: open an elevated PowerShell console and type: PS> Enable-PSRemoting -Force There are two types of...