• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Anyone do any Powershell?

Scarpozzi

Lifer
I've been playing with Powershell to do some csv manipulation and am loving it. I've used it in the past for legitimate sys admin stuff (creating AD and exchange accounts, deleting them, etc...)... My new job doesn't do that stuff so much, but I still have to work with a lot of csv files. The problem with csv is that it's not formatted, so when I pass these files off, they open in excel, but are very plain.

I'm now using it to create excel files, import the csv and format the columns on multiple worksheets...then do the cleanup of the many CSVs that feed the worksheets and ship the files out. It's nice because I can write the script and it saves me about 10 minutes of editing work every time I run a report.

Does anyone else use it for this kind of thing or have any other ideas of how I can utilize it? It's free and ties in really nicely to report writing (which is what my job does a lot of now).
 
Are you using any guides or anything? I'd be interested in this as well. I really should be doing some more of this to accumulate information. I do use it for general sysadmin functions but not much for reporting.
 
I used TechNet for a long time to get a lot of my background in powershell commandlets. I've also had mixed results with some of the commandlets. I learned that if there are too many files in a folder/directory, 'get-childitem' and piping the result into select could malfunction. Get-content vs import-csv doesn't always give you the same results.

As for the Excel manipulation, there are 2 ways people do this. They either do a simple copy of the csv into an xlsx file or they do what I did and follow the connector method to do it in the more traditional manner.

There are far shorter versions of code, but this page is the method I followed. I liked the way it could be replicated and I changed the code to handle many different worksheets. I may throw some dynamic values in so it will build $X worksheets, but I hardcoded a report and it's working flawlessly.

http://zomaar.com/scripting/importing-a-csv-file-into-excel-using-powershell-the-fast-way/
 
I use it for everything... it's pretty awesome. I do a lot of data manipulation from AD / Exchange / VMware etc... to create my own Objects and sometimes export them to CSV. PowerShell is great!
 
I wish I knew more (or anything, really) about it. I'm supposed to take a couple hours of training in it from AppDev.com through work but haven't gotten to it yet.

I'm a .NET developer but I have a feeling if I knew PowerShell I'd be able to automate different things I have to now do manually.
 
I wish I knew more (or anything, really) about it. I'm supposed to take a couple hours of training in it from AppDev.com through work but haven't gotten to it yet.

I'm a .NET developer but I have a feeling if I knew PowerShell I'd be able to automate different things I have to now do manually.

It does automation pretty well, but you have to remember to run the shell as Administrator in a lot of cases... One of my biggest gripes with Powershell is that a lot of the methods it uses to do certain searches can be very slow. You should consider that if you notice any speed issues.
 
Yes, it is handy when you have to do large repetitive tasks, even non-Powershell related tasks. I even it use it to run PAR2 check and recovery on a large set of files with multiple sets of PAR2 files.

Recursively query all files that have extension PAR2 and remove any files that contain the string VOL then pipe the names of those files into the command line PAR2 file checker.

Similarly, you can query and extract all RAR archive files.
 
Back
Top