Adding New Nodes to an XML Document

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...

Adding New Nodes to an XML Document

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...

Adding New Nodes to an XML Document

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...

Adding New Nodes to an XML Document

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...

Adding New Nodes to an XML Document

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...

Adding New Nodes to an XML Document

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...

Adding New Nodes to an XML Document

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...

Adding New Nodes to an XML Document

Updating Your Office Phone Number in Active Directory

Updating Active Directory User Information with PowerShell If you have installed the free RSAT tools from Microsoft, you can use PowerShell to update information stored in your AD user account, for example your office phone number. Permissions for Updating Active...

Adding New Nodes to an XML Document

Cloning Active Directory Security Settings

Whenever you add delegation rights to an AD object (i.e. allow a user to manage the members of an organizational unit), you really invoke a change of security settings for the given AD object. Cloning Active Directory Security Settings Easily AD security descriptors...

Adding New Nodes to an XML Document

Bulk-Remove Protection for Accidental Deletion in AD

Removing Accidental Deletion Protection By default, AD objects are protected from accidental deletion. To remove this protection for all objects in a given scope (i.e. all objects in an organizational unit and below), try this code: #requires -Version 1 -Modules...

Part 1: Monitoring Analysis Services(SSAS) Performance

Part 1: Monitoring Analysis Services(SSAS) Performance

So you’re a DBA and your manager comes in and says that the BI team wants to install and configure an instance of Analysis Service. Oh and by the way, you are going to be responsible for monitoring the availability and performance of the instance as well as making...

Adding New Nodes to an XML Document

Using Green Checkmarks in Console Output

In a previous tip you have seen that the PowerShell console supports all characters available in a TrueType font. You just need to convert the character code to the type "Char". Advanced Example: Using Splatting for Console Output Here is a more advanced example that...

Adding New Nodes to an XML Document

Using Symbols in Console Output

Did you know that console output can contain special icons like checkmarks? All you need to do is set the console to a TrueType font like "Consolas". To display special characters, use the decimal or hexadecimal character code, for example: [Char]8730 [Char]0x25BA...

Adding New Nodes to an XML Document

Removing Whitespace (and Line Breaks)

You may know that each string object has a method called Trim() that trims away whitespace both from the beginning and end of a string: $text = ' Hello ' $text.Trim() Trim() and Line Breaks A lesser known fact is that Trim() will also eat away leading and trailing...

Adding New Nodes to an XML Document

Understanding break, continue, return, and exit

Understanding Control Flow: break, continue, return, and exit Do you know off-hand what "break", "continue", "return", and "exit" do? These are powerful language constructs, and here is a test function to illustrate how different their effects are: 'Starting' function...

Adding New Nodes to an XML Document

Getting Registry Values and Value Types

Get-ItemProperty can easily read registry values, but you do not get back any information about the registry value type. Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion' Alternative Approach Using .NET Here is an alternate approach that uses...

Adding New Nodes to an XML Document

Tinker, Tailor, Developer, DBA

Tinker, Tailor, Developer, DBA is not intended as a pitch on a slightly less harrowing book or movie than the John Le Carre classic.   Rather, it is a consideration of the career progressions of those working in and around SQL Server and how that progression...

Adding New Nodes to an XML Document

Measuring Website Response (and Execution Times)

PowerShell 3.0 and later Sometimes it is important to know just how long a command takes. For example, to monitor web site response times, you could use Invoke-WebRequest. Measure-Command measures execution time. $url = 'http://www.powershell.com' # track execution...

Team DBA and Collaboration

Team DBA and Collaboration

In previous blog posts I have explored the relevance of the DBA position itself in business  and the unique ways that SQL Server DBAs tend to fall into their positions.   After mulling over those topics I found myself considering the varying...