header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Script shortcut
Last Post 01 Mar 2010 12:51 AM by Bobdee. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
BobdeeUser is Offline
Basic Member
Basic Member
Posts:130
Avatar

--
26 Feb 2010 07:59 AM
    Anyone know how to create a shortcut to a quest powershell script?

    IE - powershell.exe -noexit c:\myscripts\myscript.ps1

    This obvisously wont work with the quest scripts as the exe file for it is stashed somewhere else.

    Basically I want to double click a shortcut that kicks a script off...  Lazy I know :-)

    Thanks.
    glnsizeUser is Offline
    Basic Member
    Basic Member
    Posts:193

    --
    28 Feb 2010 09:26 AM
    Couple of points, there are no special exe files for third party cmdlets. Instead there is a console file (psc1) that is used to customize the env, preload snappins, set variables and such. This console file is what gives the illusion of a custom exe. You can easily use this same psc1 file to do exactly as you're question implied...

    create a shortcut that executes:
    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -psconsolefile "%ProgramFiles%\Quest Software\Management Shell for AD\ConsoleSettings.psc1" -noexit -file c:\myscripts\myscript.ps1

    You could also just add the snapin in you're script and skip the console file entirely, i.e. somewhere in you're scripts begin block add;

    Add-PSSnapin Quest.ActiveRoles.ADManagement

    It's not lazy at all it's smart!
    ~Glenn
    BobdeeUser is Offline
    Basic Member
    Basic Member
    Posts:130
    Avatar

    --
    01 Mar 2010 12:51 AM
    Brilliant Glenn!

    I've used the Add-PSSnapin solution, it seems tidier (well, less hassle)... I appreciate the response - you've made my life a lot easier :-)

    Thanks again,

    Robbie.

    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer