powershell

MSBuild in a Powershell Script - How do I know if the build succeeded?

I am writting a build script with Powershell. The scripts performs various operations such as getting the latest source code off the SVN, backups, etc., and builds the solution using MSBuild: cmd /c C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe "C:\Dev\Path\MyProjct.sln" /p:Configuration=Release After this instruction, I only w...

Changing account name and password on Windows Services remotely

I need to write a program / script to change the account name and password on certain services running on a remote server. I intend to do it with Powershell. Is that the best solution or is there something else that would be more suitable? A quick google search brought up this script: $account="domain\userName" $password="password" $s...

Can Powershell Run Commands in Parallel?

I have a powershell script to do some batch processing on a bunch of images and I'd like to do some parallel processing. Powershell seems to have some background processing options such as start-job, wait-job, etc, but the only good resource I found for doing parallel work was writing the text of a script out and running those (PowerShe...

Cannot use vaiable with Get-User -Filter in Exchange Management Console

I cannot seem to use variable in the situation below. [PS] C:\>Get-User -Filter {SamAccountName -eq "Test.Smith"} Name RecipientType ---- ------------- Test Smith UserMailbox [P...

Using the nupack Package Manager Console to set working folder to solution folder

In Visual Studio, nupack adds a power-shell window called the Package Manager Console. I am thinking that this would be a good place to run source control commands (I'm using Mercurial). However, the default working directory is my users folder, so I need to navigate to my code folder every time I load a new project. I am wondering if t...

Is it possible to automate Silverlight with PowerShell?

It is possible to automate Silverlight with PowerShell? I want to control Silverlight, press buttons etc. Like automation with the IExplorer: $ie = New-Object -ComObject InternetExplorer.Application $ie.Navigate("http://www.stackoverflow.com") $ie.Document.getElementById("ButtonID")|foreach{ $_.Click() } ...

It is possible to deactivate the InternetExplorer Silverlight Add-On with PowerShell?

Hello, it is possible to deactivate the InternetExplorer Silverlight Add-On? Later I want to open the Internet Explorer with the Powershell command: $ie = New-Object -ComObject InternetExplorer.Application ...

Get PID of COM server

I create a com object in powershell like so: $application = new-object -ComObject "word.application" Is there a way to get the PID (or some other unique identifier) of the launched MS Word instance? I want to check if the program is blocked e.g. by modal dialogs asking for passwords, and I can't do it from whithin PowerShell. Thx! ...

BEST WAY ??? automated-tests with powershell-scripts in internetexplorer (Windows7)

Hello, Currently I create a program, which shall automated-tests. To allow for this problem-free I must deactivate Silverlight (because my scripts don´t work in windows7 otherwise). Is there a chance to do this, without the user must admin-permissions have? If yes: what chance is it? If no: Can I create the program only for users with...

PowerShell "execution of scripts is disabled on this system."

Hi Folks, I am trying to run the a .cmd file that calls a powershell script from the command prompt and I am getting the below error: "Management_Install.ps1 cannot be loaded because the execution of scripts is disabled on this system." I have ran the set-executionpolicy unrestricted and when I do a get-executionpolicy from Powershell...

Why is this PowerShell script deleting svn:mergeinfo from the root directory?

We have a script to delete the svn:mergeinfo property from all folders inside a Subversion working copy, but not the working copy root directory itself. It's currently an NAnt build script invoked via a separate batch file, so I'm trying to replace it with a simpler PowerShell script. I've had three attempts at it, ranging from the naï...

Listing full address path with Windows PowerShell

I have a small script that searches through all files in a directory using something like this; Get-ChildItem $location -recurse | select-string -pattern $pattern | select-object Path, FileName, LineNumber > C:\test.txt The problem I have is that the Path gets enshortened, like this; C:\program files\new folder\new f... How can ...

Deactivate add-ons by start IE with powershell (for automated tests)

Hello, I write a script for automated tests. I want that the IE runs without add-ons. It would be OK if set this after the start of it, but it is important that I can work with the IE. (I must can to grab it for my testing). I want start IE with following powershell-script: $ie = new-object -comobject InternetExplorer.Application -pro...

Errors not ignored in Start-Job InitializationScript

I have a script module whose .psm1 file runs a command that will fail if a certain registry value is not present. I want to ignore this failure, so the .psm1 script runs the command as: CommandThatMayFail -ea SilentlyContinue This works just fine when I import the module in a PowerShell session. But one of the functions in this modu...

How can I convince powershell (run through task scheduler) to find my network drive?

I have a simple powershell script on windows 7 that doesn't work properly. (this is not an issue on XP) get-psdrive When I run it directly, I get Name Used (GB) Free (GB) Provider Root ---- --------- --------- -------- ---- A FileSystem A:\ Alias ...

Powershell: Including jQuery in InternetExplorer.Application

I Followed this article, explaining how to spice up an Internet Explorer COM-Object with jQuery. While the author used Python, I want to do something similar in Powershell. So now I have this code: function addJQuery ($browser) { $url="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" $document = $browser.docume...

ScriptBlock.GetNewClosure() Behavior

I am trying to figure out how ScriptBlock.GetNewClosure() works. Based on this thread (see Stej's answer) I have this code: $i = 1 $block1 = { $i } $i = 2 $block2 = { $i } $i = 3 $block3 = { $i } & $block1 & $block2 & $block3 The output is: 3 3 3 which is expected, because when the ScriptBlocks are executed the c...

Invoke-Sqlcmd unavailable from the ISE, but works in conventional Powershell host

I'm having some trouble with Invoke-Sqlcmd From the normal powershell console, it's fine. But I'm unable to use it from the ISE. I can confim the addin is loaded >Get-PSSnapin SqlServerCmdletSnapin100 Name : SqlServerCmdletSnapin100 > add-PSSnapin SqlServerCmdletSnapin100 Add-PSSnapin : Cannot add ... SqlServerCmdletSnapin100 ....