473,382 Members | 1,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Running Python Script in Powershell

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,
Shalong
Sep 16 '08 #1
3 7319
Nepomuk
3,112 Expert 2GB
Hi Shalong!

Although the Windows PowerShell is a Microsoft Product, I guess the Python experts can help you much more with this question than the Windows team can. Therefore, I'm moving this to the Python Forum.

Greetings,
Nepomuk (Moderator)
Sep 16 '08 #2
Thanks Nepomuk,

For the time being im just printing everything generated by the python script to a .ps1 file and running this file in powershell.

Shalong
Sep 17 '08 #3
Smygis
126 100+
Try and see if powershelter has someting like pythons -c flag.

Expand|Select|Wrap|Line Numbers
  1.  
  2. >>> import os
  3. >>> os.popen('''python -c "print 'hello'"''').read()
  4. 'hello\n'
  5. >>> os.system('''python -c "print 'hello'"''')
  6. hello
  7.  
  8. >>> 
  9.  
One would think powershell has something similar.
Sep 17 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: BartlebyScrivener | last post by:
The Windows Powershell is available, fka Monad. Any special Python tricks? Just breezing through the manual, they seemed to have borrowed from any language they wanted in making a new scripting...
5
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...
3
by: =?Utf-8?B?VGhvbWFzIFcuIEJyb3du?= | last post by:
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...
6
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...
1
by: Alexander Vasilevsky | last post by:
Hi! How to debug Powershell commandlets? -- http://www.alvas.net - Audio tools for C# and VB.Net developers
2
by: jetoo | last post by:
Hi there, i'm trying to run a powershell script from a aspx page. Here's the code: //Powershell arguments String powershell = "C:\\WINDOWS\\system32\...
5
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...
0
by: eddiefisher41 | last post by:
Hey guys. Im having problems running a python cgi. Im using the example code from: http://www.python.org/doc/essays/ppt/sd99east/sld041.htm as writen by Van Rossum himself I can get the script...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.