Jump to content

[W10/x64] AutoIt-Script will only access UNC-Path if I manually open the Taskmanager once


Recommended Posts

Hi all,

I have an insanely obscure problem at work which I feel is maybe more of a Windows-Problem than an AutoIt one.
If this is the wrong forum, apologies, feel free to move my post.
I have absolutely no idea what's going on here and can't find any solutions to similar problems online.

I have a few Windows 10 x64 clients that need to run an AutoIt Script at startup with local Administrator privileges.
What the script basically does can be broken down to the following lines:

Global $CheckForFile = "\\myserver\myshare\somefile.txt"

While 1
    If FileExists($CheckForFile) Then _DoSomething()

It waits for an file to appear at a given UNC-Path and does something if this is the case.
The script is a compiled .exe and gets started via the Windows Task Scheduler under the context of the default local admin user whenever he logs on.
The "Run with highest privileges" is also checked.

Now here's the really weird part:

Once the user logs on, the script starts and even the tray icon can be seen. But it doesn't do anything, even if the file exists already.
The script starts operating the second I manually start the Task Manager. For example like this, by right-clicking on the task-bar:


I don't even have to do anything else like switch to the Details-Tab and inspect the process or something.
Opening up Task-Manager and closing it is enough for the script to work flawlessly for the rest of the windows-session.

The script works correctly without this if I:

  • ..manually start the script by right-clicking it and select "Run As Administrator"
  • ..manually start the task from the windows task schedule
  • ..run the task manager once (as above).

So, my current workaround is another AutoIt-script in the Windows startup folder of the admin user which does this:

ShellExecute("taskmgr.exe", "", "", "", @SW_MINIMIZE)

Yeah, this works, but I don't like this solution very much because it makes me have two AutoIt scripts in different startup places.
The script in question doesn't generate any windows or message boxes at all.
None of the scripts contain a #RequireAdmin.

I really need some help here...  any ideas much appreciated!

Best regards,

Edited by Radiance
Link to comment
Share on other sites

You should log where in your script it's hanging before opening task manager. Then log in your script where it's going after the task manager is opened, to see what is being triggered by opening the task manager. Put a file write after it jumps from one state to the next to see where this is happening.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I don't know what to log.
The example above is only a slight variation of what I actually tried:

Global $CheckForFile = "\\myserver\myshare\somefile.txt"

While 1
    If FileExists($CheckForFile) Then FileDelete($CheckForFile)

I swapped the pseudo func for a FileDelete().
This is the whole script which I actually have the exact same problem with. Path names are not the real ones for privacy reasons.

The file already exists beforehand and gets deleted once I start up the task manager.
FileExists on just the \\myserver\myshare also returns 0 as long as the taskmanager doesn't get started.

Edited by Radiance
Link to comment
Share on other sites

  • 3 weeks later...

Curious - can you try to start->run->\\myserver\myshare instead of opening task manager?

I once had an issue where Intel NICs caused a problem with mapped connections, it was related to a setting in the NIC driver for "Wait for link". Only with Intel NICs, though.



Always carry a towel.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...