powershell

Progress during large file copy (Copy-Item & Write-Progress?)

Is there any way to copy a really large file (from one server to another) in Powershell AND display it's progress? There are solutions out there to use Write-Progress in conjunction with looping to copy many files and display progress. However I can't seem to find anything that would show progress of a single file. Any thoughts? ...

Selecting strings and case sensitivity

I am trying to filter for an object that has a Title field and I want to ignore case. Is there a way to make sure case sensitivity of turned off? | Where-Object {$_.Title -like "myString"} ...

Powershell profile "on exit" event?

I'm looking for a way to automatically do some clean up tasks when the PowerShell session quits. So for example in my profile file I start a process which needs to run in the background for quite a lot of tasks and I would like to automatically close that process when I close the console. Is there some function the PowerShell automatica...

Applying powershell outside IT Management.

Hi. We have a flexible process control system by which automation engineers configure up large application comprising thousands of small logical units that are parameterized and integrated into the control flow. There are many tasks that are repetitive on the granular level, and there are a multitude of proprietary productivity tools t...

GAC (64bit system) comparison?

How to compare the 64bit systems GAC using powershell? Parameters: Assembly name full name version ...

How to read the xml file and write its content into a plain text file?

How to read the below xml file and write its content into a plain text file? <!-- < config > < compare > < source >d:\demo\< /source > < destination >e:\demo\< / destination > < parameters > < parameter >FileName< /parameter> < parameter >Size< /parameter> < parameter>Date< /parameter> < /parameters > < /compare > < ...

How can I copy files with timestamps between 2 times and preserve the directory structure

I want to copy files that have timestamps from the time the script begins to run and a hour previous. So I am basically trying to emulate robocopy but with minage and maxage going down to the exact time rather than days. So far I have this in powershell: $now = Get-Date $previousHour = $now.AddHours(-1) "Copying files from $previousHo...

How to append to a log file in powershell?

Hi there, I am doing some parallel SQL Server 2005 database restores in powershell. The way I have done it is to use cmd.exe and start so that powershell doesn't wait for it to complete. What I need to do is to pipe the output into a log file with append. If I use Add-Content, then powershell waits, which is not what I want. My code sn...

Client-Side script to upload attachments to the Sharepoint 2007 list

Hello. I have no good script-writing experience. So, I have a list created on MOSS 2007 with about 1000 elements and attachments enabled. I need to attach to each list item file (*.jpg) from a local folder. I doesn't have administrator privileges at MOSS server, only contributor rights Here is my PoSh script: $web = new-Object system...

C# Exchange Powershell specified cast not valid

I'm getting a specified cast error trying to return a integer, example code below: results = pipeline.Invoke(); foreach (PSObject ps in results) { int diff = 0; Int32 exchcount = Convert.ToInt32(ps.Members["itemcount"].Value); diff = itemcount - exchcount; } I'm trying to find out what the data type if for itemcount of the Get-Mailbo...

C# Application Calling Powershell Script Issues

Hi, I have a C# Winforms application which is calling a simple powershell script using the following method: Process process = new Process(); process.StartInfo.FileName = @"powershell.exe"; process.StartInfo.Arguments = String.Format("-noexit \"C:\\Develop\\{1}\"", scriptName); process.Start(); The powershell script simply read...

Avoiding Agnostic Jagged Array Flattening in Powershell

Hello, I'm running into an interesting problem in Powershell, and haven't been able to find a solution to it. When I google (and find things like this post), nothing quite as involved as what I'm trying to do comes up, so I thought I'd post the question here. The problem has to do with multidimensional arrays with an outer array length...

Does Powershell have an "eval" equivalent? Is there a better way to see a list of properties and values?

I'm doing a bit of Powershell scripting ( for the first time ) to look at some stuff in a Sharepoint site and what I would like to be able to do is to go through a list of properties of an object and just output their values in a "property-name = value" kind of format. Now I can find the list of elements using this: $myObject | get-mem...

Get Active Directory Attributes for Users on Legacy Exchange Servers

I would like to create a CSV file of the users on our Exchange 2003 servers, and include some attributes from their AD account. In particular, I would like to pull certain AD values for the users with RecipientTypeDetails = LegacyMailbox. I have tried a few different methods for targeting and filtering (ldapfilter, filter, objectAttrib...

Cannot Generate ParameterSetMetadata While Programmatically Creating A Parameter Block

I'm trying to programmatically create a parameter block for a function ( along the lines of this blog post ). I'm starting with a CommandMetadata object (from an existing function). I can create the ParameterMetadata object and set things like the ParameterType, the name, as well as some attributes. The problem I'm running into is t...

Update Azure Service Configuration File using Powershell

I'm trying to write a powershell script that updats each of the DiagnosticsConnectionString and DataConnectionString values below, but I can't seem to find each individual Role node using $serviceconfig.ServiceConfiguration.SelectSingleNode("Role[@name='MyService_WorkerRole']") doing echo $serviceconfig.ServiceConfiguration.Role list...

Equivalent to Bash Alias in Powershell

Hi there, a newbie powershell question: I'd like to make an alias in powershell exactly equivalent to this Bash alias: alias django-admin-jy="jython /path/to/jython-dev/dist/bin/django-admin.py" In tinkering with it so far, I've found this to be very difficult. -Powershell Aliases only work with Powershell commands + function calls ...

Exporting info from PS script to csv

Hi, This is a powershell/AD/Exchange question.... I'm running a script against a number of Users to check some of their attributes however I'm having trouble getting this to output to CSV. The script runs well and does exactly what I need it to do, the output on screen is fine, I'm just having trouble getting it to directly export to c...

IIS 6.0: what is the WMI equivalent of "Convert Folder To Application"?

Basically, imagine you need to automate these steps: Open Internet Information Services. Find the web site, find the folder, right click the folder and select properties. Click the Directory folder. Under Applications settings, click the Create button. The application is now created. Click OK to finish. (click for a pictoral walk...

Get Windows Last Reboot Timestamp?

I have a PC on remote connected by network, but it occasionally crashes or is restarted by remote users. After the restart, some services and applications have to be in running status. So I would like to find out the reboot as soon as possible. I think PS may be a good choice with some scripts so that I could make remote call to get the ...