powershell-v1.0

Trying to compile VS2008 project on Win 64 bit which is custom Powershell PSSnapin

Library Project compiles fine for ANY CPU in VS2008 running on Win 7 64 -bit. Now in the post build following command fails when attemptiong to register library dll: PS C:\Windows\Microsoft.NET\Framework64\v2.0.50727> .\installutil C:\path\Project.dll Exception occurred while initializing the installation: System.BadImageFormatExcep...

Powershell 1.0 - Renaming files fails when script is in a different directory

I am trying to batch rename old log files, but the script only works for me when the script is stored in the same folder as the log files. Here is the code: cls $file = gci E:\logs |? {$_.extension -eq ".log" |% {rename-item $_ ($_.Name + ".old")} When I run this script from E:\logs, it works just fine. However, when I run this scri...

Exception Handling in Powershell 1.0

I am using the following code to upload a file using PowerShell 1.0. How can I tell if the upload completed successfully or if there was an error? I need to delete the file if the upload was successful. What I have tried: 1. the trap clause. Cant seem to get this one to work. 2. Checking the return value of $webclient.UploadFile -- this...

Help me use powershell and bcp to load CSV into SQL Server

I'm using bcp to load a table from a CSV exported from another table by someone else far far away, and have run into some issues. My original two problems: one exported field is an int that needs to end up in a varchar field, and another field needs to be populated with a static string. Well, the first is no big deal, and Chad's answer l...

Help with Script for Extracting Specific Data from String

Below is a list of data in a single file. I'd like to run this in Powershell. LESCAR85 07/31/10 1700678991 / 70039536 $35.00 SQUADCT8 07/31/10 1698125739 / 70039539 $35.00 RINGFIEL 07/29/10 11041563 / 70039639 $35.00 The 8 digit number and then the dollar amount at t...