Find text (string) in text file(s)

If you want to find a certain text (string) in a text file or multiple text files, the quickest way to do so, is by using the select-string option. First you'd need to get a list of the files you want to search trough: $FileList = Get-ChildItem -Path "D:\temp\" or you can use it on … Continue reading Find text (string) in text file(s)

Get-Date

The Get-Date cmdlet is pretty nifty and gives you a lot of date/time formats you'd want to use in your script. Like if you were to save files with a unique stamp, you'd want a date/time format like <year><month><day><hour><minute><second> Here are some examples to achieve this goal, with outputs Get-Date -Format s 2015-11-19T20:22:35 (Get-Date -Format s).Replace("-","").Replace(":","").Replace("T","") … Continue reading Get-Date

Notepad++ downloader and updater

I love to use Notepad++ (npp), but I also have npp installed on servers on which users can log on, but don't have administrative privileges. They also love to use npp, but with the updater enabled, they get popup messages for the updates, but cannot install them. I don't want to have to check all servers that I … Continue reading Notepad++ downloader and updater

Powershell application – Get information from a webpage, parse it and show the results

Today I created a nice little 'application' in Powershell. In The Netherlands we have a site called Marktplaats (www.marktplaats.nl) which is some sort of combination between e-bay and craiglist. This is one of the biggest sites in The Netherlands, but I was missing some search options on this site and thought they started to show … Continue reading Powershell application – Get information from a webpage, parse it and show the results

How simple some things can be – Powershell indent

In the past few years, I've been using tools to indent my code... Today by accident found out that in Powershell ISE, if you select multiple lines and press tab it'll indent all selected lines... and of course shift+tab will do the reverse. Amazing how simple some things can be without any tool... And how … Continue reading How simple some things can be – Powershell indent

Analyze Robocopy log files and mail the result

A long, long time ago (back in 2008) I created a VBS script which would analyze a folder filled with Robocopy logs and once done analyzing and creating a summary, it would mail the result to me. A couple of days ago I decided it was time to update this script to Powershell. Once I … Continue reading Analyze Robocopy log files and mail the result

Get all (non-default) scheduled tasks

I tried querying the scheduled tasks to give me a list of all (non-default) scheduled tasks. I also wanted to have its schedule information, which appeared to be a pretty hard task in the get-service command. After several unsuccessful attempts, I tried something else with great and immediate results. It appeared that the schtasks did … Continue reading Get all (non-default) scheduled tasks

Get all non-default Windows services

Getting a list of all services isn't that hard. This can be achieved with Get-Service or with Get-WmiObject win32_service. It seems that Get-Service doesn't leave me with enough properties to query and/or filter out, and this time the Get-WmiObject queries work quick enough; thus I'll use this for my code. I wanted a list of all … Continue reading Get all non-default Windows services

Add-WindowsFeature Error: 0x800f0902 – The operation cannot be completed because Windows is currently performing another servicing operation

Today I encountered a problem, for which I couldn't find a solution (which is pretty rare), so thought I'd post a blog about it and maybe someone can help me. I sometimes have a problem with the Add-WindowsFeature. In powershell, overall it works fine, but sometimes it gives me the following error: Add-WindowsFeature: The request … Continue reading Add-WindowsFeature Error: 0x800f0902 – The operation cannot be completed because Windows is currently performing another servicing operation

Creating an ODBC connection

With Powershell 4 on Windows 8 and 2012, they've improve the support for ODBC connections. You just need to import the Wdac module to be able to use the different ODBC functions. Get-Command *ODBC* shows the following functions: Add-OdbcDsn Disable-OdbcPerfCounter Enable-OdbcPerfCounter Get-OdbcDriver Get-OdbcDsn Get-OdbcPerfCounter Remove-OdbcDsn Set-OdbcDriver Set-OdbcDsn For instance, if you were to create a … Continue reading Creating an ODBC connection