Here is another (and very solid) approach to remove leading zeroes from an IP address using a regular expression: '010.012.000.101' -replace...
database-tools
Get Fully Qualified Domain Name
There are two simple tricks to find out your current fully qualified domain name (FQDN). You can either resort to ping.exe: PS> ping -a localhost...
Finding Next Sunday
If you'd like to find out how long it is until next Sunday (or how many days have passed since last Sunday), simply use the property DayOfWeek. It...
Launching Applications with Alternate Credentials
If you must run an application with a different identity, Start-Process offers the parameter -Credential. This would launch the Notepad editor using...
Configure SQL diagnostic manager for non-standard ports
SQL Server uses the port 1433 as its standard listening port. Hackers know this and will use it to more easily hack into your SQL...
Manipulating Scheduled Tasks
If you need to change and adjust settings in a registered scheduled task, there is a COM interface called 'Schedule.Service' that you can...
Dumping Scheduled Tasks
There is an underestimated option to make schtasks.exe dump scheduled tasks as CSV data. PowerShell can grab the CSV data and turn it into objects,...
Create Strongly Typed Hash Table
A hash table can store any data type. If you want more control, you can create a typed dictionary (which behaves pretty much like a hash table): $ht...
Get Quotes From the Webservices
There are plenty of free webservices around, and provided you have direct Internet access (no proxy), you can use New-WebServiceProxy to access...
Using Safe Cmdlets Only
Let's assume you want to set up a restricted PowerShell v3 console that just provides access to Microsoft cmdlets with the verb Get. One way to...
Lucky number 13 : Big Data, Little Data, we don't discriminate
We have begun seeding release candidates of Aqua Data Studio version 13.0 with a planned stable release beginning of May. We have some new members...
Why Back Up the Transaction Log if not Interested in Point-in-time Restore?
I’ve heard people say many times that they don’t use full or bulk-logged recovery model or backup the transaction log of their database...
Check Installed Server Roles and Features
Beginning with Server 2008 R2, there is a PowerShell module called ServerManager that you can use to manage server features and optional components....
Finding Published Printers
Finding printers that have been published in your Active Directory becomes trivial with Windows 8 or Server 2012. PS> Get-Printer -ComputerName...
Calculating Time Differences Using Custom Formats
Calculating time differences is easy - provided you can convert the date and time information into a DateTime type. If the date is in a custom...
Get CPU Load
To get the average total CPU load for your local system or a remote system, use Get-Counter. The example below returns the average total CPU load...
Calling WMI Methods with CIM Cmdlets
It can be very useful to call WMI methods, for example to create new shares, but in PowerShell v2 you had to know the names and exact order of...
Temporarily Activate High Performance Power Plan
It may be useful to automatically and temporarily switch to a "high performance" power plan from inside a script. Maybe you know that a...
Listing Power Plans
There is a somewhat hidden WMI namespace that holds WMI classes you can use to manage power plans. The code below lists all power plans on your...
Mixing DCOM and WSMan in WMI Queries
Using the new CIM cmdlets in PowerShell v3, you can run remote WMI queries against multiple computers using multiple remoting protocols. The sample...
New Operator -In
In PowerShell v3, you can use a new simplified syntax for Where-Object. Both lines below list all files in your Windows folder that are larger than...
Removing Leading "0" in IP Addresses
Leading "0" in IP addresses can cause confusion because many network commands interpret octets with leading "0" as octal...
CIM-Cmdlets Work Against Old Windows Boxes
The new CIM cmdlets require PowerShell v3, but you can still remotely target older boxes without PowerShell v3 or PowerShell at all. By default, CIM...
New WMI Cmdlets with DateTime Support
In PowerShell v3, to work with WMI you can still use the old WMI cmdlets like Get-WmiObject. There is a new set of CIM cmdlets, though, that pretty...