Search Results

Search found 1743 results on 70 pages for 'powershell'.

Page 17/70 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • how to stop powershell mangling command line options for program executed from shell?

    - by kem
    From the powershell prompt, when I try to run a program and feed it a command line option, powershell ends up mangling the option. Why does this happen? Is there any way to stop it besides enclosing the option in quotes? For example, from the powershell prompt: PS Microsoft.PowerShell.Core\FileSystem::\\mach\share .\myprog.exe -file=input.txt myprog.exe ends up getting two arguments: 1) -file=input 2) .txt I need to run it like: .\myprog.exe "-file=input.txt" or .\myprog.exe '-file=input.txt' to force it to be one argument. No other shell does this.

    Read the article

  • How to avoid Remove-Item PowerShell errors "process cannot access the file"?

    - by Michael Freidgeim
    We are using TfsDeployer and PowerShell script to remove the folders ising Remove-Item before deployment of a new version. Sometimes the PS script failed with the error Remove-Item : Cannot remove item Services\bin: The process cannot access the file Services\bin' because it is being used by another proc Get-ChildItem -Path $Destination -Recurse | Remove-Item <<<< -force -recurse + CategoryInfo : WriteError: (C:\Program File..\Services\bin:DirectoryInfo) [Remove-Item], IOException FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand I’ve tried to follow the answer from PowerShell remove force to pipe get-childitem -recurse into remove-item. get-childitem * -include *.csv -recurse | remove-item ,but the error still happens periodically. We are using unlocker to manually kill locking application, (it’s usually w3wp), but I prefer to find automated solution. Another (not ideal) option is to-suppress-powershell-errors get-childitem -recurse -force -erroraction silentlycontinue Any suggestions are welcome.

    Read the article

  • Manage SQL Server Connectivity through Windows Azure Virtual Machines Remote PowerShell

    - by SQLOS Team
    Manage SQL Server Connectivity through Windows Azure Virtual Machines Remote PowerShell Blog This blog post comes from Khalid Mouss, Senior Program Manager in Microsoft SQL Server. Overview The goal of this blog is to demonstrate how we can automate through PowerShell connecting multiple SQL Server deployments in Windows Azure Virtual Machines. We would configure TCP port that we would open (and close) though Windows firewall from a remote PowerShell session to the Virtual Machine (VM). This will demonstrate how to take the advantage of the remote PowerShell support in Windows Azure Virtual Machines to automate the steps required to connect SQL Server in the same cloud service and in different cloud services.  Scenario 1: VMs connected through the same Cloud Service 2 Virtual machines configured in the same cloud service. Both VMs running different SQL Server instances on them. Both VMs configured with remote PowerShell turned on to be able to run PS and other commands directly into them remotely in order to re-configure them to allow incoming SQL connections from a remote VM or on premise machine(s). Note: RDP (Remote Desktop Protocol) is kept configured in both VMs by default to be able to remote connect to them and check the connections to SQL instances for demo purposes only; but not actually required. Step 1 – Provision VMs and Configure Ports   Provision VM1; named DemoVM1 as follows (see examples screenshots below if using the portal):   Provision VM2 (DemoVM2) with PowerShell Remoting enabled and connected to DemoVM1 above (see examples screenshots below if using the portal): After provisioning of the 2 VMs above, here is the default port configurations for example: Step2 – Verify / Confirm the TCP port used by the database Engine By the default, the port will be configured to be 1433 – this can be changed to a different port number if desired.   1. RDP to each of the VMs created below – this will also ensure the VMs complete SysPrep(ing) and complete configuration 2. Go to SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for <SQL instance> -> TCP/IP - > IP Addresses   3. Confirm the port number used by SQL Server Engine; in this case 1433 4. Update from Windows Authentication to Mixed mode   5.       Restart SQL Server service for the change to take effect 6.       Repeat steps 3., 4., and 5. For the second VM: DemoVM2 Step 3 – Remote Powershell to DemoVM1 Enter-PSSession -ComputerName condemo.cloudapp.net -Port 61503 -Credential <username> -UseSSL -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) Your will then be prompted to enter the password. Step 4 – Open 1433 port in the Windows firewall netsh advfirewall firewall add rule name="DemoVM1Port" dir=in localport=1433 protocol=TCP action=allow Output: netsh advfirewall firewall show rule name=DemoVM1Port Rule Name:                            DemoVM1Port ---------------------------------------------------------------------- Enabled:                              Yes Direction:                            In Profiles:                             Domain,Private,Public Grouping:                             LocalIP:                              Any RemoteIP:                             Any Protocol:                             TCP LocalPort:                            1433 RemotePort:                           Any Edge traversal:                       No Action:                               Allow Ok. Step 5 – Now connect from DemoVM2 to DB instance in DemoVM1 Step 6 – Close port 1433 in the Windows firewall netsh advfirewall firewall delete rule name=DemoVM1Port Output: Deleted 1 rule(s). Ok. netsh advfirewall firewall show  rule name=DemoVM1Port No rules match the specified criteria.   Step 7 – Try to connect from DemoVM2 to DB Instance in DemoVM1  Because port 1433 has been closed (in step 6) in the Windows Firewall in VM1 machine, we can longer connect from VM3 remotely to VM1. Scenario 2: VMs provisioned in different Cloud Services 2 Virtual machines configured in different cloud services. Both VMs running different SQL Server instances on them. Both VMs configured with remote PowerShell turned on to be able to run PS and other commands directly into them remotely in order to re-configure them to allow incoming SQL connections from a remote VM or on on-premise machine(s). Note: RDP (Remote Desktop Protocol) is kept configured in both VMs by default to be able to remote connect to them and check the connections to SQL instances for demo purposes only; but not actually needed. Step 1 – Provision new VM3 Provision VM3; named DemoVM3 as follows (see examples screenshots below if using the portal): After provisioning is complete, here is the default port configurations: Step 2 – Add public port to VM1 connect to from VM3’s DB instance Since VM3 and VM1 are not connected in the same cloud service, we will need to specify the full DNS address while connecting between the machines which includes the public port. We shall add a public port 57000 in this case that is linked to private port 1433 which will be used later to connect to the DB instance. Step 3 – Remote Powershell to DemoVM1 Enter-PSSession -ComputerName condemo.cloudapp.net -Port 61503 -Credential <UserName> -UseSSL -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck) You will then be prompted to enter the password.   Step 4 – Open 1433 port in the Windows firewall netsh advfirewall firewall add rule name="DemoVM1Port" dir=in localport=1433 protocol=TCP action=allow Output: Ok. netsh advfirewall firewall show rule name=DemoVM1Port Rule Name:                            DemoVM1Port ---------------------------------------------------------------------- Enabled:                              Yes Direction:                            In Profiles:                             Domain,Private,Public Grouping:                             LocalIP:                              Any RemoteIP:                             Any Protocol:                             TCP LocalPort:                            1433 RemotePort:                           Any Edge traversal:                       No Action:                               Allow Ok.   Step 5 – Now connect from DemoVM3 to DB instance in DemoVM1 RDP into VM3, launch SSM and Connect to VM1’s DB instance as follows. You must specify the full server name using the DNS address and public port number configured above. Step 6 – Close port 1433 in the Windows firewall netsh advfirewall firewall delete rule name=DemoVM1Port   Output: Deleted 1 rule(s). Ok. netsh advfirewall firewall show  rule name=DemoVM1Port No rules match the specified criteria.  Step 7 – Try to connect from DemoVM2 to DB Instance in DemoVM1  Because port 1433 has been closed (in step 6) in the Windows Firewall in VM1 machine, we can no longer connect from VM3 remotely to VM1. Conclusion Through the new support for remote PowerShell in Windows Azure Virtual Machines, one can script and automate many Virtual Machine and SQL management tasks. In this blog, we have demonstrated, how to start a remote PowerShell session, re-configure Virtual Machine firewall to allow (or disallow) SQL Server connections. References SQL Server in Windows Azure Virtual Machines   Originally posted at http://blogs.msdn.com/b/sqlosteam/

    Read the article

  • Speaking - SQL Saturday 173, Washington DC

    - by AllenMWhite
    After a great time at the PASS Summit in Seattle I'll be once again presenting on PowerShell for SQL Server at SQL Saturday #173 in Chevy Chase, Maryland. On Friday, December 7 I'll be presenting my full day session Automate and Manage SQL Server with PowerShell . Here's the abstract: This soup-to-nuts all day session will first introduce you to PowerShell, after which you'll learn the basic SMO object model, how to manipulate data with PowerShell and how to use SMO to manage objects. We'll then...(read more)

    Read the article

  • PowerShell Advanced Function get current ParameterSetName

    - by spoon16
    In C# you can get the current ParameterSetName in the ProcessRecord override of a PowerShell Cmdlet with code like this: switch (ParameterSetName) { case FromUriParamSetName: loadFromUri(); break; case FromFileParamSetName: loadFromFile(); break; } I'm trying to figure out how I can get the value for ParameterSetName in a script cmdlet (Advanced Function).

    Read the article

  • PowerShell - Shorten namespace names so it's easier to access types

    - by Adam Driscoll
    Is there a method of shortening PowerShell namespace references? Typing [RootNameSpace1.NameSpace2.Namepsace3+SomeEnum]::SomeValue is taxing and not a very good user expierence. I realize that you can reference System level objects without a namespace such that [Type]::GetType(... will work. Is there some manifest I could create or command I could use to shorten lengthy namespaces?

    Read the article

  • PowerShell - Set Alias for Loaded Assembly

    - by Uros Calakovic
    I use this code to load a .Net assembly to PowerShell: [System.Reflection.Assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") | out-null [System.Windows.Forms.MessageBox]::Show("Hello world") Can I set an alias for an assembly (for example 'System.Windows.Forms' = 'Forms') so that I don't have to type the assembly full name when calling static methods like MessageBox.Show()?

    Read the article

  • Powershell: Read value from xml files

    - by DanielR
    I need some with help with PowerShell, please. It should be pretty easy: I have a list of subdirectories, with a xml file in each one. I want to open each xml file and print the value of one node. The node is always the same, as the xml files are actually project files (*.csproj) from Visual Studio. I already got the list of files: get-item ** \ *.csproj How do I proceed?

    Read the article

  • Listing available COM Objects with Powershell

    - by outtacontrol
    I am currently using the following script to list the available COM Objects on my machine. $path = "REGISTRY::HKEY_CLASSES_ROOT\CLSID\*\PROGID" foreach ($obj in dir $path) { write-host $obj.GetValue("") } I read on another website that the existence of the InProcServer32 key is evidence that the object is 64 bit compatible. So using powershell how can I determine the existence of InProcServer32 for each COM Object? If that is even the correct way of establishing whether it is 32 bit or 64 bit.

    Read the article

  • Powershell 2 remove single binding iis 7

    - by user358625
    I am trying to remove one site binding. I am using powershell 2 and iis 7. I am able to remove all bindings with Remove-ItemProperty, and when i use Set-ItemProperty it removes all binding and just adds the new. I would be great if i could just rename or just remove a single binding without effecting the others. A sample would be great.

    Read the article

  • Opening console applications in powershell

    - by Fredrik
    Hi, I'm currently developing a win32 console application, and wondering if there is any way to make visual studio open it in powershell instead of cmd.exe when I'm debugging it. All I really want is a better shell, where I can copy/paste etc. without clicking. Thanks

    Read the article

  • Generate SQL script to insert XML from files, using Powershell

    - by Jeff Meatball Yang
    I have a bunch of (50+) XML files in a directory that I would like to insert into a SQL server 2008 table. How can I create a SQL script from the command prompt or Powershell that will let me insert the files into a simple table with the following schema: XMLDataFiles ( xmlFileName varchar(255) , content xml ) All I need is for something to generate a script with a bunch of insert statements. Right now, I'm contemplating writing a silly little .NET console app to write the SQL script. Thanks.

    Read the article

  • PowerShell locking File....

    - by Ben
    I am trying to do something very simple in powershell Reading the contents of a file Manipulation some string Saving the modified test back to the file function Replace { $file = Get-Content C:\Path\File.cs $file | foreach {$_ -replace "document.getElementById", "$"} |out-file -filepath C:\Path\File.cs } I have tried Set-Content as well. I always get unautorized exception. I can see the $file has the file content, error is coming while writing the file. Any help is appreciated. Ben

    Read the article

  • Concatenate SQL script from Powershell

    - by Jeff Meatball Yang
    I have a bunch of (50+) XML files in a directory that I would like to insert into a SQL server 2008 table. How can I create a SQL script from the command prompt or Powershell that will let me insert the files into a simple table with the following schema: XMLDataFiles ( xmlFileName varchar(255) , content xml ) All I need is for something to generate a script with a bunch of insert statements. Right now, I'm contemplating writing a silly little .NET console app to write the SQL script. Thanks.

    Read the article

  • Calculate broadcast address given IP address and subnet in PowerShell

    - by halr9000
    My goal is to calculate the broadcast address when given the IP and subnet mask of a host node. I know, sounds like homework. Once I reasoned through my task and boiled it down to this, I was amused with myself. Anyway, the solution will look something like the one in this question I suppose, but I'm not a math major and my C sucks. I could do with a PowerShell (preferred) or C# example to get me going. thanks!

    Read the article

  • Unable to get members of Universal Distribution List using Powershell

    - by PowerShellScripter
    I am trying to write a script to list out all members of a "Universal Distribution List" using Powershell. However I keep getting an empty result set back. When I run the following command against a "Global Distribution List" it works fine and I can see who belongs to it. dsquery group -name "SomeGroup" | dsget group -members -expand However as I mentioned when I run this against a "Universal Distribution List" I get no results. Can anyone help?

    Read the article

  • powershell.exe tab completion - list alternatives?

    - by J Cooper
    I've never really used PowerShell before, and playing with it a bit, it looks like it uses cmd.exe's style of tab completion (fill in the first likely candidate, and then you can use tab to cycle through other alternatives). I'd much prefer the way e.g. bash works, where if there are multiple candidates, it shows a list of them. Is there an easy way to turn this on, by any chance?

    Read the article

  • How to split long commands over multiple lines in PowerShell

    - by asgerhallas
    How do you take a commmand like this in PowerShell and split it across multiple lines: &"C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync -source:contentPath="c:\workspace\xxx\master\Build\_PublishedWebsites\xxx.Web" -dest:contentPath="c:\websites\xxx\wwwroot\,computerName=192.168.1.1,username=administrator,password=xxx"

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >