header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

listen on a socket...
Last Post 15 Aug 2008 09:15 PM by glnsize. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
glnsizeUser is Online
New Member
New Member
Posts:84

--
14 Aug 2008 02:58 AM  

Short background... I have a series of PowerShell scripts that provision a new user. Our provisioning process lives within Solaris/php.  Currently I’m checking a folder for the presents of a file.  If that file is present then I query a web service requesting the list of users requiring an account.  Create the accounts, mailboxes, and anything else Microsoft related.  Finally reporting back the status of the whole sha-bang.

Our current solution is secure but inefficient.  I would like to set up shop on a socket and wait for notification that an account needs action.  I originally got this idea from Bruce's book and the web server written entirely in posh. Does anyone know of another example doing something like this? 

My desired end state is to have a service that listen's for requests.  That service (written in posh) can only have enough privileges to start a scheduled task that will kick off the whole process. 

Feel free to point out a better way to accomplish my end goal.  My main problem is that our ARS system (not quest) sucks, and takes upwards of 45 min to create a windows account.  In an attempt to alleviate the load this places on my tier 2 guy's.  I generated the above, but need it to be as secure and bulletproof as our current system.

Thanks
~Glenn
halr9000User is Offline
Basic Member
Basic Member
Posts:316

--
14 Aug 2008 03:43 AM  
You know I think I have something that might just be of interest to you...Go check out /n software's powershell remoting server. First actually, go listen to ep 36 of my show. We interviewed a guy from /n software and we talk all about the server product. _then_, download the trial version and write a script using it and send it to us before sunday to win a copy of the full version. :)

As opposed to PS V2 CTP stuff, this remoting solution uses SSH as its transport. See where I'm going with this? You could do something to the effect of "ssh scheduler@windowsserver $bin/deployUser.ps1" from Solaris.

Start here.
marco.shawUser is Offline
Co-Community Director
Basic Member
Basic Member
Posts:181

--
14 Aug 2008 04:31 PM  
For more server-side code to create a listener:
http://ps1.soapyfrog.com/2007/01/24/webserver-and-rsh-in-powershell/

You want to restrict what the runspace can do... That may be difficult in PowerShell v1 or you'll need to think about how to implement this.

If you just want a simple UDP packet or TCP connection to kick off your process, then you might not need to worry about restricting your shell, but if you'll be parsing incoming information, then you'd need to be a bit more careful.

I've been wanting to try our OpenWSMAN to see if a UNIX/Linux system could use ws-man to connect to a remote Windows server and actually kickoff a PowerShell script...

Hal's option is good also. Even any regular SSH server could be used, and you could call powershell.exe &{run_my_script.ps1} or similar. It is cool though to be right in a PowerShell runspace once you SSH in though.
glnsizeUser is Online
New Member
New Member
Posts:84

--
15 Aug 2008 09:15 PM  

@marco that is exactly what I was looking for System.Net.HttpListener did the trick, and that is a great example!

@hal, I have a pending request for /n netcmdlets for that very reason...  I registered for the hobbyist license, but it doesn't appear to contain posh server. Policy restricts me from installing trial versions, so I'll have to wait and see if they buy it.

Thank you both, as is usually the case once you know the starting point the rest is easy. 

~Glenn

You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer