Using Credentials In Production Scripts

Sometimes you have to save credentials when running a scheduled task. There are ways to save the credentials in the windows credentials manager, but sometimes you need to store them as a file. In this post I go over how I go over how I store credentials securely in a file. While there are some limitations and things to remember, this is useful for working with scheduled tasks.

Read More

Remote PowerShell Commands With WinRM Disabled And Windows PowerShell

WinRM is extremely useful when using Windows Powershell - but what do you do when it is disabled? How do you work with PowerShell on remote machines without breaking security policy? I explore a method to be able to do this using existing remote technologies which will not make security upset at you.

Read More

Get-ADUser times out after 2 minutes

This past week I was approached by a coworker that had a script which was timing out in less than 30 minutes - the default ADWS timeout. They were using get-aduser with a few conditions in the filter parameter, resulting in only about 30 user accounts being returned. The query was randomly timing out and there was no immediate clue as to why in the error message. This is being run against a complex ad environment with 80k+ users in the environment. After doing some searching around the error results from the timeout between paginated results. After finding this page the answer became obvious.

Because there are so few results being returned due to the filter in such a large environment - and the default pagination size is 256 results the timeout of two minutes is being hit. In this case - since there were only 30 or less results the pagination limit of 256 was never hit and therefore if the query took more than two minutes an error was returned. The simple solution is to reduce the number of results returned on each “page” of results by setting the parameter ResultPageSize to a lower number. In this case, because they were only expecting 30 / 80k+ users to be returned we set the ResultPageSize parameter to 1. This means that for each result returned, the two minute time limit is once again refreshed preventing the query from timing out.

HPE Synergy Automation - Mounting Virtual Media and Override Boot Order

HPE Synergy and OneView not only allows you to create server profiles automatically but also set a one time boot options even on UEFI servers and boot to ISOs which are stored on a web server to install the operating system on multiple servers simultaneously.

Read More

Validating CSV Headers In Your Scripts

Validating csv files tends to be one of those things that has to be customized for each script. I was tired of this, and wanted to make a way to be able to validate csv files before any of the script was run to prevent issues - so I created a new project to be able to validate CSV files and return WHAT of the csv file is invalid.

This is only the first start of the project with more to come eventually to allow the cmd to be a little more flexible in HOW it determines if a CSV is valid or not.

Read More