473,666 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Powershell questions??

1. Is there a dedicated discussion group for Windows Powershell? I couldn't
find one, but that doesn't necessarily mean there isn't :-)

2. I'm just starting in on learning to use Powershell and doing so by slowly
(very slowly) attempting to port some existing CMD and Perl scripts. I'm
blocked right now on something that should be very simple (I would think)...

I want to use SQLCMD to issue a query and parse/format the return string.
But when I enter the command to the Powershell prompt:

sqlcmd -S server -d database -E -Q"query"

It just returns to a ">>" prompt as if its waiting for the completion of the
command and nothing I enter seems to "complete" the command. A Ctrl+C
returns me to the main Powershell prompt without executing the command.

What am I missing??

Thanks,
-- TB
Jun 14 '07 #1
3 2673
Thomas W. Brown wrote:
1. Is there a dedicated discussion group for Windows Powershell? I
couldn't find one, but that doesn't necessarily mean there isn't :-)
news://msnews.microsoft.com/microsof...ows.powershell

Andrew
Jun 14 '07 #2
"Thomas W. Brown" <th************ @countrywide.NO SPAM.comwrote in message
news:F2******** *************** ***********@mic rosoft.com...
1. Is there a dedicated discussion group for Windows Powershell? I
couldn't
find one, but that doesn't necessarily mean there isn't :-)
microsoft.publi c.windows.power shell
>
2. I'm just starting in on learning to use Powershell and doing so by
slowly
(very slowly) attempting to port some existing CMD and Perl scripts. I'm
blocked right now on something that should be very simple (I would
think)...

I want to use SQLCMD to issue a query and parse/format the return string.
But when I enter the command to the Powershell prompt:

sqlcmd -S server -d database -E -Q"query"

It just returns to a ">>" prompt as if its waiting for the completion of
the
command and nothing I enter seems to "complete" the command. A Ctrl+C
returns me to the main Powershell prompt without executing the command.

What am I missing??
What's the whole command? I don't have that problem.

Here's the SQL command that works for me:

PS C:\sqlcmd -S server -E -d DB -Q "select * from table"

Jun 14 '07 #3
"John Vottero" wrote:
"Thomas W. Brown" <th************ @countrywide.NO SPAM.comwrote in message
news:F2******** *************** ***********@mic rosoft.com...
1. Is there a dedicated discussion group for Windows Powershell? I
couldn't
find one, but that doesn't necessarily mean there isn't :-)

microsoft.publi c.windows.power shell

2. I'm just starting in on learning to use Powershell and doing so by
slowly
(very slowly) attempting to port some existing CMD and Perl scripts. I'm
blocked right now on something that should be very simple (I would
think)...

I want to use SQLCMD to issue a query and parse/format the return string.
But when I enter the command to the Powershell prompt:

sqlcmd -S server -d database -E -Q"query"

It just returns to a ">>" prompt as if its waiting for the completion of
the
command and nothing I enter seems to "complete" the command. A Ctrl+C
returns me to the main Powershell prompt without executing the command.

What am I missing??

What's the whole command? I don't have that problem.

Here's the SQL command that works for me:

PS C:\sqlcmd -S server -E -d DB -Q "select * from table"
Doh!!! I was not adding whitespace between the -Q and quoted query. From
the regular CMD shell no space is necessary, but in Powershell I guess it is
:-/

Thanks,
-- TB

Jun 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2601
by: Neil Chambers | last post by:
Hi All, I'm looking to see if it's feasible to use the SortObjectCommand included in the Microsoft.Powershell.Commands assembly. I have a Dictionary Dictionary<string, intd = new Dictionary<string, int>(); d = new int;
6
16557
by: Mesan | last post by:
Does anyone have an idea what it takes to administer DB2 through PowerShell? I want to write some scripts to automate my common DB2 management tasks and I'd really like to be able to use PowerShell for that scripting, but I can't find a way to run DB2 comands. I've tried db2cmd /w db2cmd /w /i db2cmd /i (this one got me the closest) db2clpex (looked promising but not so helpfu)
1
2563
by: Alexander Vasilevsky | last post by:
Hi! How to debug Powershell commandlets? -- http://www.alvas.net - Audio tools for C# and VB.Net developers
5
6773
by: josepharmbruster | last post by:
I am all about using the right tool for the right purposes, which is why I have started reading the GettingStarted guide to PowerShell. I am curious if any other pythoneers have ventured into the world of PowerShell. Mostly, I am interested in grabbing perspectives on the differences noticed from those that have working experience with using both. I dug up one article from Google that talked about comparison but that was about it.
3
1480
by: sridhard2406 | last post by:
Hi I didn't find a forum for powershell so i'm my query here itself. I'm runnung a powershell script and i want to redirect the output to a xml after redirecting the output i need to search a pattern in the outfile and print on the console. is the below is correct filename.ps1 |out-file abc.xml | search-string -pattern "Status"
0
2398
by: =?Utf-8?B?SmVycnk=?= | last post by:
Hi, I just don't get it :( I'm using VB.NET code, within this code I want to call some Powershell code. (To create a user mailbox in Exchange 2007). How can I run Powershell code in vb.net? -- Best regards,
3
7329
by: shalong | last post by:
Hi all, I want to run a python script to create a large number of Exchange mailboxes. I am using the os.system("New-Mailbox.......) method. However if i try to execute the python script in powershell it runs it in simple old cmd prompt (which dosent have cmdlets such as New-Mailbox) Is there any way I can run the python in powershell or will i have to go and write a .ps1 script?? Thanks,
1
3136
by: =?Utf-8?B?YXVsZGg=?= | last post by:
i read the MS kb: Using Exchange Management Shell Commands With Managed Code http://msdn.microsoft.com/en-us/library/bb332449.aspx how ever i'm getting "{"No Windows PowerShell Snap-ins are available for version 1."}" exception when i try to call PSSnapInInfo info = rc.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapEx);
1
3515
by: SCRIPT KEEPER | last post by:
Hello, I am a complete noob and just starting off with csharp so I apologize for my basic question. I am wanting to start powershell from inside a batch script and then to pass the powershell args from the batch, so from the batch I can use the name of the compiled csharp app without having to include the "call" command. Something like "Compiled Csharp app.exe" "PowerShell Args" etc..... Thank You for any help.
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8883
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8787
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8561
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.