Skip to content

Scripting

SQL Log shipping restore

After last post we copy all backup files from the source to the destination. If all files is on the destination server we can now restore them into a database to complete the log shipping. I will not write about the functions that is the same in both files such as Import-MyModule. See last blog post if you have not read it.

SQL Log Shipping Copy

This is a two-part blog post. The second part will be published within a week. The script was created a while ago and has some minor updates.

Problem

The need was found to have two database servers very similar, without a license for SQL Log shipping. We could use existing backups, as we did a log backup each hour, and copy them to another server for restoration. The process turned out to be more complex than anticipated, especially with SQL clusters.

List all computers with a specific file

Problem to solve

The customer has clients with locally stored application files. The files are from an earlier application and should not be used anymore. I needed to verify that the application files was removed from the clients. I did not want to walk to each 500+ clients so I created a small script to use “test-path” to see if the files were removed and then summarise it.

VMware to cmdb script part 1

This is a two blog post divided into two posts. The second will be published within a week from this one.

Problem

Today we lack information about virtual servers in our VMware environment which cause problems within each billing period with manual labour of verifying disk size, memory and cpu of each VM. With little to no money we needed a way to inventory and save the information for others to use and present it on a website.

tail -f for powershell

If you have setup something in an Linux environment you have most likely done some troubleshooting. The command tail -f [path] is very convenient command. I had no idea that a similar existed on Windows until recently. In powershell to read a file, the command Get-Content is very neat. I had no idea that with “-wait” you could get the same result as in “-f” in tail. Very handy for parsing Windows firewall logs.

Unmount VM-ISOs after days

I had a minor issue with lingering ISOs in an VMM-environment. The issue wasn’t a technical one but a “soft” one. The users admins of the environment did not unmount ISOs after usage. So I created a small script that is triggered once a day and unmounts all ISOs that is more than a week old.