Monthly Archives: October 2016

PowerShell: Parse all Text Files in a Directory for a String Pattern

Here’s a snippet of PowerShell that goes through all files in a directory looking for a string. Those files that match the string pattern are then moved to another directory. Set-Location C:\somewhere Get-ChildItem -Recurse | Select-String -pattern "Delivery Status Notification" … Continue reading

Posted in PowerShell | Leave a comment

T-SQL: View and Set SQL Server Maximum Memory Usage

Here’s how you can use T-SQL to set the maximum memory to use. In this example, if the server has more than 4GB of RAM, it reduces SQL Server’s usage by 1GB; if it has less than 4GB, it reduces … Continue reading

Posted in T-SQL | Leave a comment

PowerShell DSC: Get Product IDs of Installed Products

The PowerShell DSC Package resource requires a ProductId and the exact product name. If you aren’t sure what product id or product name associated with the software you wish to install, you can try this method: Install the software manually … Continue reading

Posted in PowerShell, PowerShell DSC | Leave a comment

Azure: Run Windows Custom Script Extension with VM Credentials

By default, the Windows Custom Script Extension in Azure will run as Local System. Here’s how you can pass your VM credentials from your Azure Resource Manager (ARM) template to the custom script extension and ensure they are not easily … Continue reading

Posted in Azure, PowerShell | Leave a comment

Assign a Drive Letter from the Command Line Using DiskPart

Here’s how you can assign a drive letter to a volume using the command line tool DiskPart. For more information, see this TechNet article. diskpart list volume select volume n assign letter F Hope this helps!

Posted in Batch Files, Windows, Windows 7, Windows Server 2008 R2, Windows Server 2012 | Leave a comment

T-SQL: Trailing Spaces And String Comparison

Here’s a useful tidbit regarding trailing spaces and SQL Server queries. Note the count of the results from the query below. Because SQL Server follows the ANSI/ISO SQL-92 specification, the string ‘test’ and ‘test    ‘ (with spaces at the end) are … Continue reading

Posted in T-SQL | Leave a comment