Finally finished bashing this article together.....a bit long-winded, but
it did what I wanted it to in the end. Thanks for everyone's help
http://appsensebigot.blogspot.co.uk/2013/10/how-to-use-appsense-environment-manager.html


On 21 October 2013 21:52, Aakash Shah <aakash.s...@uci.edu> wrote:

>  Thanks for the here-strings usage – very helpful!  I’ll be able to use
> this on another script I’m working on today J****
>
> ** **
>
> -Aakash Shah****
>
> ** **
>
> *From:* listsad...@lists.myitforum.com [mailto:
> listsad...@lists.myitforum.com] *On Behalf Of *Michael B. Smith
> *Sent:* Monday, October 21, 2013 12:50 PM
>
> *To:* ntsysadm@lists.myitforum.com
> *Subject:* RE: [NTSysADM] More PowerShell****
>
>  ** **
>
> Why make this hard? Perfect usage for a here-string.****
>
> ** **
>
> @”****
>
> class rte ****
>
> {****
>
>                 static void Main() {****
>
>                                 System.Threading.Thread.Sleep(2000);****
>
>                 }****
>
> }****
>
> ”@ | Out-File c:\temp\trigger.ps1****
>
> ** **
>
> ** **
>
> *From:* listsad...@lists.myitforum.com [
> mailto:listsad...@lists.myitforum.com <listsad...@lists.myitforum.com>] *On
> Behalf Of *Webster
> *Sent:* Monday, October 21, 2013 12:26 PM
> *To:* ntsysadm@lists.myitforum.com
>
> *Subject:* RE: [NTSysADM] More PowerShell****
>
>  ** **
>
> It works for me.****
>
> ** **
>
> Windows PowerShell****
>
> Copyright (C) 2009 Microsoft Corporation. All rights reserved.****
>
> ** **
>
> PS C:\Windows\system32> "class rte`n{`n`tstatic void Main()
> {`n`t`tSystem.Threading.Thread.Sleep(2000);`n`t}`n}" | Out-File
> "c:\trigger.ps1"****
>
> PS C:\Windows\system32>****
>
> ** **
>
> Then I open c:\trigger.ps1 in NotePad++****
>
> ** **
>
> class rte****
>
> {****
>
>                 static void Main() {****
>
>                                 System.Threading.Thread.Sleep(2000);****
>
>                 }****
>
> }****
>
> ** **
>
> ** **
>
> Thanks****
>
> ** **
>
> ** **
>
> Webster****
>
> ** **
>
> *From:* listsad...@lists.myitforum.com [
> mailto:listsad...@lists.myitforum.com <listsad...@lists.myitforum.com>] *On
> Behalf Of *James Rankin
> *Sent:* Monday, October 21, 2013 11:22 AM
> *To:* ntsysadm@lists.myitforum.com
> *Subject:* Re: [NTSysADM] More PowerShell****
>
> ** **
>
> Hmmm.....gives me tabs, but no new lines....I will see if this can help me
> learn tho :-)****
>
> ** **
>
> On 21 October 2013 17:17, Aakash Shah <aakash.s...@uci.edu> wrote:****
>
> Unless I am misunderstanding you, the command for that would be:****
>
>  ****
>
> "class rte`n{`n`tstatic void Main()
> {`n`t`tSystem.Threading.Thread.Sleep(2000);`n`t}`n}" | Out-File
> “c:\trigger.ps1”****
>
>  ****
>
> This will give you a file that is formatted as show below (I assume by
> formatting, you were referring to the new lines and tabs).****
>
>  ****
>
> -Aakash Shah****
>
>  ****
>
> *From:* listsad...@lists.myitforum.com [mailto:
> listsad...@lists.myitforum.com] *On Behalf Of *James Rankin
> *Sent:* Monday, October 21, 2013 9:04 AM****
>
>
> *To:* ntsysadm@lists.myitforum.com
> *Subject:* Re: [NTSysADM] More PowerShell****
>
>  ****
>
> OK, Ken's idea might be workable - but I still need to create the .cs text
> file dynamically somehow to feed into csc.exe****
>
>  ****
>
> Can I do that in PowerShell? (Actually I know I can) But it's the
> formatting that's defeating me now :-( How would I create a text file in PS
> and format it correctly to get this text in****
>
>  ****
>
> *class rte*****
>
> *{*****
>
> *   static void Main() {*****
>
> *            System.Threading.Thread.Sleep(2000);*****
>
> *   }*****
>
> *}*****
>
>  ****
>
> I seem to be getting plenty of Google hits on feeding text in from other
> files, but that defeats the object****
>
>  ****
>
>  ****
>
> TIA,****
>
>  ****
>
>  ****
>
>  ****
>
> JRR****
>
>  ****
>
> On 19 October 2013 00:05, Ken Schaefer <k...@kj.net.au> wrote:****
>
>  Why can’t you call vbc.exe or csc.exe (command line VB.NET / C#.NET
> compilers)?****
>
>  ****
>
> Then you’d just need a VB.NET or C# source file that just does a Sleep in
> the Main() function and exits.****
>
>  ****
>
> Cheers****
>
> Ken****
>
>  ****
>
> *From:* listsad...@lists.myitforum.com [mailto:
> listsad...@lists.myitforum.com] *On Behalf Of *Rankin, James R
> *Sent:* Saturday, 19 October 2013 3:27 AM****
>
>
> *To:* ntsysadm@lists.myitforum.com
> *Subject:* Re: [NTSysADM] More PowerShell****
>
>  ****
>
> Not sure of the exact terminology required....basically uses some .Net
> functions to create an executable, in the example I have.****
>
>
>
> I can run the script as System, so it functions OK with the privilege
> required.
>
> Cheers,
>
>
> JR****
>
> Sent from my BlackBerry, which may make me an antiques dealer, but it's
> reliable as hell for email delivery :-)****
>  ------------------------------
>
> *From: *"Michael B. Smith" <mich...@smithcons.com> ****
>
> *Sender: *listsad...@lists.myitforum.com****
>
> *Date: *Fri, 18 Oct 2013 16:23:29 +0000****
>
> *To: *ntsysadm@lists.myitforum.com<ntsysadm@lists.myitforum.com>****
>
> *ReplyTo: *ntsysadm@lists.myitforum.com ****
>
> *Subject: *RE: [NTSysADM] More PowerShell****
>
>  ****
>
> So you don’t actually mean “compiles an executable”. You mean “compiles a
> source file into an executable”. Is that correct?****
>
>  ****
>
> You are aware that placing the executable in %ProgramFiles% is a high
> privilege operation?****
>
>  ****
>
> *From:* listsad...@lists.myitforum.com [
> mailto:listsad...@lists.myitforum.com <listsad...@lists.myitforum.com>] *On
> Behalf Of *James Rankin
> *Sent:* Friday, October 18, 2013 9:35 AM
> *To:* ntsysadm@lists.myitforum.com
> *Subject:* Re: [NTSysADM] More PowerShell****
>
>  ****
>
> Just to redefine, then...****
>
>  ****
>
> I am looking for a script (PowerShell, VB or JScript will do) that creates
> an executable in a specified place. The compiled executable code does
> nothing but pauses for a second or two and then closes.****
>
>  ****
>
> The one I currently have does this:-****
>
>  ****
>
> Compiles an executable that will run for a couple of seconds then exit****
>
> Creates the executable file called xxx.exe in %ProgramFiles%\xxx****
>
>  ****
>
> This is all I actually need it to do - I am using it as a kind of
> user-defined trigger for other actions.****
>
>  ****
>
> On 18 October 2013 14:32, Michael B. Smith <mich...@smithcons.com> wrote:*
> ***
>
> I'm wondering if I also misunderstood. Would you say more?
>
> Sent from my Windows Phone****
>   ------------------------------
>
> *From: *Manuel Santos <nel...@gmail.com>
> *Sent: *10/18/2013 9:29 AM
> *To: *ntsysadm@lists.myitforum.com
> *Subject: *Re: [NTSysADM] More PowerShell****
>
> Hi James. I am not quite sure on what you want. Can you please PM me, as I
> might have a solution for you. ****
>
> Thanks****
>
>  ****
>
> 2013/10/18 James Rankin <kz2...@googlemail.com>****
>
> Hmmm, bummer. I thought I was just getting hit by a lot of Google-chaff
> because every link I could find simply talks about creating an executable
> from a PS script, which is obviously not what I want. Rather frustrating
> when you know it's possible because I've got code that works but can't use
> it :-(****
>
>  ****
>
> On 18 October 2013 14:02, Michael B. Smith <mich...@smithcons.com> wrote:*
> ***
>
> I’ve got 3 different ways of doing this, all work for hire (which means it
> can’t be shared). I don’t know of anyone that did this and placed it in the
> public domain. If you find one, let me know too. J****
>
>  ****
>
> *From:* listsad...@lists.myitforum.com [mailto:
> listsad...@lists.myitforum.com] *On Behalf Of *James Rankin
> *Sent:* Friday, October 18, 2013 7:09 AM
> *To:* NTSysADM@lists.myitforum.com
> *Subject:* [NTSysADM] More PowerShell****
>
>  ****
>
> A guy I knew once gave me a bit of PowerShell which would compile an
> executable on an endpoint. The executable did nothing except run for a
> couple of seconds and then exit, which was exactly what I needed.****
>
>  ****
>
> Unfortunately I am now putting together a blog post which utilizes this
> handy function but the guy who wrote it is unwilling for me to use his
> code, even with a credit. So I thought I'd Google about and try and find my
> own way of doing it.....but I can't find anything I can make head or tail
> of.****
>
>  ****
>
> Can anyone point me in the direction of some PS that can do this sort of
> thing, so I can put together my own bit of code for the blog post?****
>
>  ****
>
> Cheers,****
>
>  ****
>
>
> ****
>
>  ****
>
> --
> *James Rankin*
> Technical Consultant (ACA, CCA, MCTS)
> http://appsensebigot.blogspot.co.uk****
>
>
>
> ****
>
>  ****
>
> --
> *James Rankin*
> Technical Consultant (ACA, CCA, MCTS)
> http://appsensebigot.blogspot.co.uk****
>
>  ****
>
>
>
> ****
>
>  ****
>
> --
> *James Rankin*
> Technical Consultant (ACA, CCA, MCTS)
> http://appsensebigot.blogspot.co.uk****
>
>
>
> ****
>
>  ****
>
> --
> *James Rankin*
> Technical Consultant (ACA, CCA, MCTS)
> http://appsensebigot.blogspot.co.uk****
>
>
>
> ****
>
> ** **
>
> --
> *James Rankin*
> Technical Consultant (ACA, CCA, MCTS)
> http://appsensebigot.blogspot.co.uk****
>



-- 
*James Rankin*
Technical Consultant (ACA, CCA, MCTS)
http://appsensebigot.blogspot.co.uk

Reply via email to