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 …
Tag Archive: one-liner
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.
1 |
@('notepad','notepad') | % {while ((gps $_ -ea 0).count -ge 1){sleep 5};start $_} |
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 …
Sep 05
PS One-Liner: #1 Lowercase your text and paste it to the clipboard, batch style!
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 …