• [decimal] conversion has some unexpected behavior depending on culture settings
    I ran into an issue where I had to convert a string value to decimal, to run a switch case on it. Once the systemlocale setting was set to en-US, there were no issues with the script, but when set to nl-NL (or any other country that uses a comma … Read more
  • SetAccessRule fails “The trust relationship between this workstation and the primary domain failed.”
    I tried to change the access rights for a path and a file. But it gave me an error. Exception calling "SetAccessRule" with "1" argument(s): "The trust relationship between this workstation and the primary domain failed. The scripts I've used, were definitely working before, so the issue wasn't with the … Read more
  • Passing user credentials to a remote computer
    I needed to do a remote installation on a server of software that is located on a share. I wanted to achieve this through a PSSession (from my management server), but I ran into the problem that the share wasn't accessible from the PSSession. As explained in this Microsoft article, … Read more
  • Register DLL or OCX file(s) & check results
    I needed to register serveral OCX files and wanted to be able to check if the result was succesfull, so my automation script could continue. I found out that HKEY_CLASSES_ROOT didn't exist as a PS drive, thus it needed to be created (thank you Lior Elia for your blog post … Read more
  • Copy Windows 10 lock screen images
    I had a very nice picture on my lock screen and wanted to see if I was able to save this image to my computer, which made me stumble upon this post op After seeing how I would be able to copy this image to my pictures, I wanted to … Read more
  • Check user credentials and set auto logon
    I had several requests from the developers at our company, to enable auto logon for various servers. I knew this was possible through regedit (as explained in this Microsoft support article) Though, sometimes it needed to be done on (test) servers which reside on a domain and sometimes it needed … Read more
  • How to get all remote logged on users
    I wanted a simple way to get all (remote) logged on (and disconnected) users on all servers in my domain. This way it's easier for me to see if there are any disconnected sessions still open. In my case I've entered them into a SQL database, but for the example … Read more
  • 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 … Read more
  • Writing to a SQL database
    Last week I needed to store information in a SQL database, so I can share certain user account information with a select group of users in the helpdesk department, but they shouldn't have access to the AD itself. So I decided that a SQL database was the way to go … Read more
  • Stop/Restart/Pause OneDrive for business
    I had an issue with OneDrive for business, which I need to use to be able to sync a SharePoint folder to my local machine. On this machine I like to do some auto cleanup with my MoveOldFiles script (a script that moves all files in certain folders to sub … Read more
  • Open Excel file and run macro
    I needed a way to open an Excel file and run one of the macro's inside the file to do some calculations and import some data then save the file as a new file, with the name of the previous month and its year added to it, to differentiate it … Read more
  • Create a sharepoint (document) library
    Creating a sharepoint library (works in both sharepoint foundation and sharepoint server) with powershell is a nice way to ensure all libraries within sharepoint are configured the same way. What we'll be doing here, is creating a library, disable anonymous access on it and only allow certain user groups to … Read more
  • Backup to zip
    I wanted to have a tool that creates a backup to a zip file, but I didn't want the zip file to be recreated every time (as it can take nearly a day for some backups I wanted to make), thus I need something to synchronize to zip and remove … Read more
  • Exporting all scheduled tasks
    I wanted to have an export of all scheduled tasks ready for all servers that I manage, thus I created a little powershell tool that does that exactly. It appeared to be pretty simple to reach this goal, as there is an Export-ScheduledTask function in Powershell. This is what I … Read more
  • It has been a while…
    It's been a while since I posted anything on this site. At work I haven't been able to work much with Powershell as other activities needed my time. Next to that I've gotten a lower back hernia, which was/is very painful and made it not able for me to sit … Read more
  • Use text to speech to read the hardest poem in the English language
    Some years ago I came across one of the hardest poems in the English language, and since I've been playing with the text-to-speech engine I decided to let the text-to-speech deal with the poem. It seemed to do very well and tought me how to pronounce some words I had … Read more
  • Text to speech alarm clock with powershell
    Thanks to a blog by Jefferey Hicks about an alarm clock in powershell using the PC speaker, I thought it would be nice to tweak that script a little bit and use Microsoft's text to speech engine so you can use the alarm and let a voice wake you through … Read more
  • Get current cpu usage for a process
    I wanted to get the current CPU usage for certain processes, which appeared to be harder than I thought. The Get-Process command will give you CPU time and program start time, but will not tell you when the CPU was being used by the process. Thus if you use the … Read more
  • Get logged on users and sessions
    There are several ways to get a list of currently logged on users on a system, but only a few return the things that I like to know. In case of my servers, I'd like to know which users are connected to which session. One way to do so is … Read more
  • Writing to Excel
    Background About a year ago I started writing things to Excel with PowerShell, based on the information I found on an MSDN blog – Create Excel file with PowerShell I wasn’t quite satisfied, though. I wanted some more formatting (specifically: change the top row behavior). It was somewhat frustrating to … Read more