gygon

PowerShell Ping Test

Posted by gygon on Wednesday, November 16th, 2011

Used this little script the other day for a basic network test to an access point I was testing. It just pings the device every 10 seconds (or whatever you set it at) and only outputs when there is an error and the time it occurred. Made for an easy way to leave this running over […]

continue reading

Using PowerShell to monitor a web server

Posted by gygon on Monday, November 14th, 2011

A couple years ago I posted about a PowerShell script that would read in a web page. I used that to setup a basic web site test to go through a list of web sites/servers and make sure they were up and running and email an alert if they were down or the size of […]

continue reading

Monitoring the Event Log with PowerShell

Posted by gygon on Saturday, March 21st, 2009

One of my goals with learning more about PowerShell is to be able to monitor the event logs on servers and notify me via email when certain events happen. The system I’m looking to monitor are not part of a domain, are in remote locations on isolated networks. Some of the main things I’m looking […]

continue reading

Running app from Mapped Drive – Avoiding UAC Prompts

Posted by gygon on Wednesday, March 2nd, 2011

While reinstalling a Windows Vista system the other day I ran into a problem with the UAC security prompt. The primary applicaiton that is run on this computer is not installed locally but run directly from a mapped drive. Normally the user just clicks on the shortcut and the app launches but after a clean install and all updates I was now getting prompted to enter credentials to allow the app to run. Since the user isn’t an admin and I don’t want them to have admin rights, this was an issue. I knew it can be set as I’d done it before but took a little bit to figure out the workaround I’d used. So for when I forget again, here’s the workaround used:

I setup a batch file (see below) that first checks that the drive is mapped, if not, it will map the drive. Then it will launch the program. This part I had done but was still getting the error. The trick I forgot was that the batch file needs to be placed into a “secure location” in order to run without the elevation request. The three locations that I know of that are considered secure are

  • \Program Files (including subfolders)
  • \Windows\system32
  • \Program Files (x86)\  (including subfolders for 64-bit versions of windows)

Once the file was setup here, I no longer get the security prompts. So the users are happy they don’t get the UAC prompts and I’m happy that I don’t need to give out the admin rights to run apps.

Here’s a copy of the basic batch file used:

If NOT exist R:\somefile.exe (
  net use R: /delete
  net use R: \\1.2.3.4\SharedFolder /user:USERNAME PASSWORD /persistent:no
)
Start /D R: somefile.exe
exit

A reference link on Microsoft Technet: http://technet.microsoft.com/en-us/library/dd835564(WS.10).aspx#BKMK_ElevateUIAccessApps

Posted in: Tech, Tips, Windows.

Comments are closed.