Counting the number of occurances of a string on a single line
Hello All, Can someone kindly help me with the following question please. At first I thougt this was going to be easy, however it is turning out to be a little more difficult than I thought I have a...
View ArticlePowershell Scripts to Look for Excel file types( .xlsx and .xls )
Hi Experts, I have an already written scripts which looks for ONLY an excel file with .xls extension. Now, 1. I want the same scripts to look for either .xls or .xlsx which ever it finds in that...
View Article$This
Hello All,Can some one please give me little more clarity on $This, I have read the help about it but not certain where you would and would not use it. I believe is similar to $_ but used in certain...
View ArticleConvertTo-HTML from log file
How can I convert a log file to HTML file without losing the format. I tried ConvertTo-HTML but it's not giving the desired output. I am not able to attach file to the post hence copied sample log...
View Articlestrange results with $foreach.MoveNext()
Hello All Can someone please help me with the following question please. I am having a difficult time with $foreach.MoveNext() If I do this cls$numbers = 1..10 foreach ($number in $numbers) {if...
View ArticleWhy I Choose PowerShell as an Attack Platform
Since the inception of PowerShell, it has been a blessing for Windows administrators everywhere. As Don Jones so eloquently puts it, "you can either learn PowerShell, or learn to ask, 'would you like...
View ArticleWindows forms event handling
(Please visit the site to view this media)Hi, Sorry, I'm about to post a big function, but I'm struggling with it: I have a dialog box which takes mutliple field values from a webpage, and lets me edit...
View ArticleCreating PowerShell Modules
By Thomas Lee This course demonstrates how to create, deploy and document PowerShell modules. Read More
View ArticleHow to get MS Office product key
Hello all, I would like to ask if is possible to get MS Office Product key from registry using powershell. I have one script which gets Windows Product key I need same think for office. Is it possible...
View ArticleCreating Custom Objects in Windows PowerShell : Part 3
In part one of this series, I discussed the basics of creating custom objects in PowerShell to meet your needs; however, in this version, we lose the original object. In part two, I showed you how to...
View ArticleCreating Custom Objects in Windows PowerShell : Part 2
As I often say, PowerShell is all about the objects. Getting your head around this object nature is one of the primary hurdlers for PowerShell newcomers. Cmdlets write objects to the pipeline, but you...
View ArticleCreating a Powershell session under a different set of credentials
Below code can be handy if you need to create a powershell session under a different credential than the one you are logged into.This allow to support multiple scenarios: Read More
View ArticleWrite log to csv file
Hi, In my script I try to write logs to a file. I use something like this in the processing loop: $sReport += "$fromValue,$toValue,$result`r`n" At the end, I do: $sReport | out-file "Report.csv" But...
View ArticleHow to Create a PowerShell Update System for Help Files
One of the best new features in PowerShell v3 is the ability to update help files. This means you can periodically run a command and download the most current versions from Microsoft. The command is...
View ArticleSwitch Error Handling
I'm prompting the user for some input for a script, a valid answer is 1, 2, 3 or 4.if(!($cmd)) {Throw "No Option Selected"Exit} Switch($cmd) { 1 {$cmd = $cmd1} 2 {$cmd = $cmd2} 3 {$cmd = $cmd3} 4 {$cmd...
View ArticleComment on Microsoft's PowerShell Documentation
I am so glad to have found powershell.com! I am a new PowerShell user and I am in a hurry. I wasted a day trying to make sense of Microsoft's official documentation. To quote an old recording, it made...
View ArticleAutomating PowerShell Reports, Part 1
I want to take a short break of my in-depth look at PowerShell-based Active Directory (AD) query tools and show you how to put some of that query power to work in a concrete way. Read More
View ArticleBash-like Tab Completion in PowerShell
When PowerShell first came on the scene, Unix folks were among the first to notice. They’d enjoyed a powerful shell and a vigorous heritage of automation for years – and “when I’m forced to use...
View ArticleRunning the WACK tool using Powershell 2012 in Windows 8 to test a Windows...
I’ve been having problems running the app on the WACK tool, as it wouldn’t find my app, and for some weird reason it wouldn’t quite work from Visual Studio either with one of the apps. So I had to do...
View Article