How to delete rows of multiple text files based on string list from another...
HelloI have multiple comma delimited text files (each has over 1 million rows). Also I have one file called "delete.log" . Structure of delete.log file is like this: STRING1 STRING2 STRING3 . . STRING...
View ArticleGet-Hotfix strange installation date
We tried to filter hotfixes by date. We got strange results. I have here a code snip to display the installation date for one specific hotfix. We installed this hotfix at 11. May 2016. Get-HotFix -Id...
View ArticleTweaking your PowerShell profile – Part 2: conditionally loading modules
Since my computer isn’t yet psychic, I opted for a simple approach where I hold down the Shift key while PowerShell loads to signal that I want the Azure cmdlets loaded. The rest of the post will show...
View ArticlePowerShell For Cyber Warriors
Sword & Shield Security Analyst Russel Van Tuyl presented the following presentation to BSides Knoxville on May 20, 2016 called, “PowerShell for Cyber Warriors.”Read More
View ArticleThe term xxx is not recognized as the name of a cmdlet, function, script...
version 2.0When I attempt to execute a Powershell script on a different letter drive than C, I get the messageThe term'F:\RateManager\Scripts\rateCopy.ps1' is not recognized as the name of a cmdlet,...
View ArticleCopy files over PowerShell Direct (and more)
We recently updated a number of the capabilities of PowerShell Direct. In Windows 10 Insider builds greater than 14280, and in Windows Server 2016, you can now create persistent PowerShell sessions...
View ArticleThe Nature of Camouflage
I was musing on the notion of camouflage recently. I’d seen a tortoise shell cat in some undergrowth and was astonished at how well it blended in, despite being a significantly different color than the...
View ArticleGetting Computer Uptime Using PowerShell
Computer uptime is an important statistic in systems management. Here are several of the ways we can determine system uptime for a computer (note that this list is by no means exhaustive):Read More
View ArticleAdding yourself to the Hyper-V Administrators group with PowerShell
I am currently setting up a couple of new computers – and thought I would share this little tidbit of information. Read More
View ArticleIssue with Name Change Script
Hi All,We are looking to change everyone's username in bulk in AD using a script. Currently the usernames are (lastname)(firstinitial) e.g. smithj to (firstname).(lastname). e.g. john.smithSo here's...
View ArticleDeleting files with more than 256 Characters in path/filename
I am trying to automate some cleanup on profiles and running into a problem with file paths that exceed 256 characters and looking for help. The folder is ..\appdata\local\Microsoft\windows\Temporary...
View ArticleFive things to know before a XenDesktop farm migration
Migrating a lot of VMs from one XenDesktop farm to another is a daunting process, but with some research and planning, it doesn't have to be so hard.Read More
View ArticleLoad Testing SSAS with PowerShell
Over the years, there has been much confusion as to the best way to load test Analysis Services. I have seen solutions ranging from as simple as using ascmd to completely custom console apps in Visual...
View ArticleMicrosoft Active Directory Health Check PowerShell Script V2.0
In July 2014, Jeff Wouters (PowerShell MVP) released his Active Directory Health Check script. A little while ago, a user emailed me asking for help as they were trying to run the script using...
View ArticleReading information from the registry
I am trying to extract information from the registry for installed software. I have this code that works.Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall,...
View Articlescriptblock issues
Hi AllI am adjusting a script that someone wrote that does a check of a Citrix XenDesktop environment. I added some additional checks to it that seem to work very well however it takes about 2 hours...
View ArticleIf statement in a Try block
I have a Ping function that I am using to ping machines with in a bigger script. One thing that I noticed is that sometime I get a failure and it reports the machine as "timed out"I would like to run...
View ArticlePing HostNames from the csv file
$servers = Import-Csv c:\Source\ping.csv#$servers = "test1", "test2", "test3"$collection = $()foreach ($server in $servers){if (Test-Connection $server -Count 1 -ea 0 -Quiet){Write-Host $server is...
View Articleclosing running apps
I have this code that works perfect. Get-Process | Where-Object {$_.Name –eq "iexplore"} | Foreach-Object { $_.CloseMainWindow() | Out-Null } | stop-process –force My issue is what if I have multiple...
View ArticleRegular Expressions
I have this code:$text='Regular Expressions in PowerShell: KB987654, KB987111, KB987999, KB987222 Get all KB numbers.'$pattern='KB(\d{4,6})'$text-match$pattern$matcheswhen I run this it returns the...
View Article