How do you call msdeploy from powershell when the parameters have spaces?
...
I'm trying to write a PowerShell script that will automate my IIS website deployments. I'm trying to run the scripts on my Windows Server 2008 R2 machine, under 32-bit in: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe Whenever I run a WebAdministration command such as this: Get-Website -Name "MYWebsite" I get an error l...
I've installed TFS Power Tools 2008 along with its PowerShell integration features on my Windows 2008 R2 developer machine. When I try to run the following command to enable the snapin: Add-PSSnapin Microsoft.TeamFoundation.PowerShell in the 32-bit version of PowerShell.exe, under C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershel...
Anyone know hoe I can load an rtf file to a wpf RichTextBox? In Windows.Forms I would do this RichTextFile.Loadfile(c:\myfile.rtf) but I don't know how to achieve the same in WPF! Thanks, Ben ...
Is this possible ?, someone has suggested that I migth be able to do via ssh, essentially run a command on Unix pipe the output to a file get it back and then perform some action in the invoking Power Shell script. ...
My script looks like this: $Users = Import-Csv "C:\users.csv" foreach ($User in $Users) { New-QADUser -Name $User.Name ` -ParentContainer $User.OU ` -FirstName $User.FirstName ` -LastName $User.LastName ` -UserPassword $User.userPassword ` -SamAccountName $User.sAMAccountName ` } When I run ...
I've been googling in vain for hours, and can't seem to find a way to view an rtf file in a powershell WPF form. I can get the rtf file using: $myContent = gc c:\myContent.rtf but when I try to display it using: $RichTextBox.appendText($myContent) I get the encoded rtf, not the properly formatted content. Anyone have a way to do ...
Hi, I was hoping somebody could help me a little with this. I'm in need of setting SIP addresses for all users where this address is not set. And the address is supposed to be the same as their e-mail address. How can I do this? So far, I know I can run get-mailbox to get all mailboxes. But I probably need to store this in a variable,...
Is there a simple way to time the execution of a command in PowerShell, like the 'time' command in Linux? I came up with this: $s=Get-Date; .\do_something.ps1 ; $e=Get-Date; ($e - $s).TotalSeconds But I would like something simpler like time .\do_something.ps1 ...
Running the following powershell command invoke-computer -computer computer -scriptblock{remove-item -force \\otherpc\backup_dump\TEST\*} I receive the error An object at the specified path \otherpc\backup_dump\TEST\ does not exist. But when I run it locally it works, I suspect there is something to do with scope here but I'...
When using Invokve Expression sqlcmd -i script.sql it seems to only display the first 2 lines returned. When I run in Query Analyser the script it returns: (2 rows affected) Changed database context to 'ShopStore'. (5 rows affected) Changed database context to 'ShopStore'. However from powershell I only get: (2 rows affected) Changed...
Is there an easier way to get a list of all the functions in a given Powershell script than matching the function signatures with a regex (in Powershell)? ...
I am bit confused of the behaviour of the script below: Test.ps1: param( [array]$Value = $(throw "Give me a value") ) Write-Host $Value $Value | Get-Member -MemberType Method $Value.ToUpper() Running the script: PS C:\Temp> .\weird.ps1 test TypeName: System.String Name MemberType Definition —- ———- ———- … ToUpper Method string...
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...
I am working on a powershell script to post json data to a REST interface and am getting (400) Bad Request on each time. I am new to this, and am unclear as to if/how I should be encoding the data. I know I need to set the contenttype to application/json, but is the encoding choice I am using what is causing my problem, and if so what ...
PowerShell Timespans are great for quickly displaying durations, as in: $starttime = $(get-date) { do some processing here } write-host "Duration: $((new-timespan $starttime $(get-date)).tostring())" But if I did $loopcount iterations of processing during that timeframe, how do I divide the duration by $loopcount to get the average du...
I need CLI for our asp.net mvc application to perform maintenance tasks and some status tasks. I think powershell is designed to provide CLI. But i do not know anything about it other than name. How can i host powershell in asp.net mvc running in iis to provide CLI for custom tasks? ...
What are the ways to pull info from an Access DB to powershell? ...
We have a .Net object that has a static delegate (a data access strategy) that has to be set before the object can be instantiated. The delegate can also be passed in through one of the constructor overloads. I have another object that has the delegate that I need to set, but I can't figure out in PowerShell how to do so. Does anyone ...
I am currently writing a PowerShell snapin that has specific dependencies on mixed-mode assemblies (assemblies containing native code) that specifically target x64 or x86. I have both versions of the dependent assembly, but I am wondering how best to manage the build and deployment of this snapin, specifically: Is it necessary to have ...