"Can I ask you a quick question?"
This usually precede a long interruption in whatever work you are doing at the time. It doesn’t matter if someone sticks their head into your cubicle while uttering these infamous words or if they pop up on an instant messenger window, inevitably you are expected to drop whatever you are doing at the time and attend to someone else’s problem.
As we have seen in the first part of this blog article, you can configure PrimalScript 2011 to run your scripts in 32 or 64 bit mode. Add that to the already existing options of running your script elevated or not, remotely or locally and you get a lot of dials to turn, buttons to push and settings to remember.
Murphy’s law dictates that while you are working on a 32 bit login script in VBScript, any "quick question" will revolve around a 64 bit Powershell script needing to run on some remote machine. Or however far on the opposite side of your current activity you can be.
Wouldn’t it be nice if your script would know where and how to run just by itself?
Since most administrative scripts are very specialized in their purpose PrimalScript 2011 can provide that with some very easy one time setup.
Adding this simple comment to your script will execute it in 64 bit mode whenever you tell it to run. Your current platform setting simply is overridden by this comment.
If your script requires elevation, you don’t need to remember that. Simply add this comment to the script and press Ctrl+F5 to run your script. It will remember to run elevated for you.
This will execute your script on the designated remote machine, by just pressing Ctrl+F5. Of course all the necessary RSEE setup must have happened ahead of time.
You can specify optional credentials with this statement:
which will prompt for a username and password or
which will prompt for the password for the specified username.
Please note that while you could specify the password directly we strongly discourage you from doing that.
These meta data comments only have effect when you issue the simple run script command. Any other specific command will still use the current settings accordingly.
There is one more comment:
But we will get to that next time.