Category Archive: One-Liner

Aug 17

PS One-Liner: #6 Remove orphaned unresolvable SIDs

I was asked for a PowerShell script to remove unresolvable SID’s because of a migration. User accounts didn’t exist on the target machine and the customer wanted to open up the security tab without any wait time and see a cleaned up and ordered ACL list. Since I adopted PSreadline every maintenance task is scripted …

Continue reading »

Jun 09

PS One-Liner: #5 Create multithreaded processes

This one is a golden oldie and used for migrating data using robocopy.  Let’s start with a simple example.

First we begin with an array ”@(notepad…)’ where we define the processes to start. Then we use foreach ‘%’ which fetches each item in the array as a pipeline item ‘$_’ and then checks how many …

Continue reading »

May 13

PS One-Liner: #4 Recycle and schedule Appools periodic restart

This will come in handy if you want to recycle specific or all AppPools which are consuming too much memory on the server. Of course you also want to avoid the memory problems in the future and don’t want to click every AppPool and set the periodic restart schedule. PowerShell to the rescue with just …

Continue reading »

Sep 25

PS One-Liner: #3 PowerShell filewatcher

Screenshot_11

I was asked if I had something to watch a web.config file and if that file changed fire off good old robocopy. That’s a easy one, you ask I roll. Filewatcher coming up.

The while loop is just used for infinite looping purposes only and  executed every five seconds, ‘sleep’ is the alias for ‘start-sleep‘. …

Continue reading »

Sep 21

PS One-Liner: #2 Query all Events from all Event Logs between a specific time frame!

092214_1231_PSOneLiner1.png

UPDATE: I made a GUI around it and published it on Technet, download it here! Did you ever found yourself in a situation where you couldn’t pinpoint the exact cause of a particular problem or you just need to know what exactly happened on your machine but can’t find the culprit? Unfortunately these things are quite …

Continue reading »

Sep 05

PS One-Liner: #1 Lowercase your text and paste it to the clipboard, batch style!

tolower

Because we had to comply with a naming convention in a system not managed by yours truly, I had to manually set each uppercase FQDN server name to lowercase in a GUI. Beware, I litterally HATE manual tasks which should and could be automated somehow even if took more time to script, there is always …

Continue reading »