Using Named Parameters in PowerShell Functions

Using Named Parameters in PowerShell Functions

When you create a PowerShell function, all parameters are positional until you start adding the “Position” attribute. Once you start to do this, all parameters with no “Position” are suddenly named and must be specified. Have a look: Example of a Classic Function...

Using Named Parameters in PowerShell Functions

Modern Replacement for systeminfo.exe

Retrieving System Profiling Information with systeminfo.exe For ages, systeminfo.exe returned all profiling information for a computer, and could made object-oriented in Powershell – somewhat: PS C:\> $info = systeminfo.exe /FO CSV | ConvertFrom-Csv PS C:\>...

Using Named Parameters in PowerShell Functions

PowerShell Remoting and HTTP 403 Error

Resolving "HTTP 403" Errors in PowerShell Remoting If you use PowerShell remoting and get “HTTP 403” errors, one of the more obscure reasons for this is a proxy that interferes with your request. Excluding the Proxy to Fix the Issue It’s easy to exclude the proxy,...

Using Named Parameters in PowerShell Functions

SQL DM & ServiceNow Email Integration

Using Email Action Responses in SQL DM to Integrate with ServiceNow This document describes the procedure of using email action responses in SQL DM to provide information to ServiceNow via its email receiver and parsing functionality to appropriately set field values...

Why Be Normal?

Why Be Normal?

Being normal may not seem like much fun; I wore a “Why Be Normal?” button with pride throughout college.  And I did it out of choice rather than as a piece of required flair. “People can get a cheeseburger anywhere, okay?They come to Chotchkie’s for the...

Using Named Parameters in PowerShell Functions

Replacing Special Chars like “Umlauts”

PowerShell 2+ Sometimes it becomes necessary to replace special characters like German “Umlauts” in order to normalize user names or email addresses. Here is a little function that illustrates how this can be done: #requires -Version 3 function...

Using Named Parameters in PowerShell Functions

5 Database Reports In SQL Server Management Tools

Built-in Database Reports in SQL Server Management Studio When connecting to a SQL Server instance in SQL Server Management Studio, there are built in reports for databases you can use for free. These RDL files or SQL Server Reporting Service reports use DMVs and DMFs...

Finding AD User by SAMAccountName

Finding AD User by SAMAccountName

PowerShell 5 The free Microsoft RSAT tools come with a full-blown ActiveDirectory module, but sometimes simple AD tasks can be mastered with just a bit of .NET code, and no dependencies to the RSAT tools. As an example, here is a function that can search users by...

Using Named Parameters in PowerShell Functions

Changing Excel Cells from PowerShell

Modifying a Specific Cell in an Excel Spreadsheet Using PowerShell If you need to change the content of a specific cell in an Excel spreadsheet, take a look at this sample code: $ExcelPath = 'c:\path..to..some..excel..file.xlst' $excel = New-Object -ComObject...

Using Named Parameters in PowerShell Functions

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, for example the installation of windows updates, and can grow massively in size. How Windows Handles Large CBS Log Files...

Why use a Date Dimension Table in a Data Warehouse

Why use a Date Dimension Table in a Data Warehouse

In the Data Mart, or the Data Warehouse world, there is a date dimension table in all schemas if you are using the Kimball Dimensional Modeling method. In the beginning of Dimensional Modeling, it was called a Time dimension. Since then, the Time dimension has...

Using Named Parameters in PowerShell Functions

Adding New Nodes to an XML Document

Adding New Items to an XML Document Efficiently If you need to add new items to an XML document that already contains such items, the easiest way is to search for an existing item, then clone it. You can then update the information in the cloned item and insert it...

Using Named Parameters in PowerShell Functions

Bringing Window in the Foreground

Bringing a Process Window to the Foreground with PowerShell PowerShell can use Add-Type to access internal Windows API functions. This way, it is easy to bring any process window into the foreground. Here is the function you need: #requires -Version 2 function...

Using Named Parameters in PowerShell Functions

Enabling Telnet Client and Watching Star Wars

By default, the Telnet client is disabled on Windows systems. You can easily enable it with a one liner in PowerShell, though. Just launch a PowerShell with full Administrator privileges, then run this command: PS C:\> dism /online /Enable-Feature...

Using Named Parameters in PowerShell Functions

Enabling PowerShell Remoting with NTLM

By default, PowerShell remoting uses Kerberos authentication and works only in domain environments, and only when you specify computer names, not IP addresses. Configuring PowerShell Remoting in Peer-to-Peer Network To use PowerShell remoting in other scenarios such...

Using Named Parameters in PowerShell Functions

Test-Connection with Timeout

The Test-Connection cmdlet implements a simple ping to check whether a system responds to an ICMP request. Unfortunately, you cannot specify a timeout. Test-Connection defaults to a static timeout of 4 seconds: PS C:\> Test-Connection -ComputerName...

Using Named Parameters in PowerShell Functions

Use Get-CimInstance with DCOM

Using Get-CimInstance as an Alternative to Get-WmiObject PowerShell 3.0 added an alternative to Get-WmiObject: Get-CimInstance seems to work very similar and can retrieve information from the internal WMI service: PS C:\> Get-WmiObject -Class Win32_BIOS...

Using Named Parameters in PowerShell Functions

Waiting for Process Launch

PowerShell has a built-in support to wait until a process or many processes end: simply use Wait-Process. Understanding Data Marts and Dimensional Modeling There is no support to do the opposite: wait until a process has started. Here is a function that can wait for...