A script to check a log file. If conditions are met the script will then delete, and copy in a file into the folder.
I wrote a quick script to automate a process I found myself doing every few months. We have software that has a maximum number of licenses available. Unfortunately, when a user logs out, the software does not release that license. To solve this issue we simply delete a .log and .dat file, and then paste a old copy of the .dat file back into that location. Sounds kind of complicated, but it might make a little more sense looking at the script. Lets take a look: The software will output a license count to a logfile that looks something like this. So in order to get the license count, we need to pull that log file into PowerShell, split it on the empty space, and then count the numbers remaining. This was a little complicated for me to figure out but this is what I came up with. $split = Import-Csv C : \Users\alexg\Desktop\Scripts\license.log -Delimiter " " -Header Name,Amount $Count = $split | Measure-Object 'Amount' -Sum | Select-...