1

We're going to be installing some new software on pretty much all of our computers and I'm trying to setup a GPO to do it. We're running a Windows Server 2008 R2 domain controller and all of our machines are Windows 7.

The GPO calls the following script which sits on a network share on our file server. The script it self calls an executable that sits on another network share on another server. The executable will imediatelly crash with an error 0x0000006. The event log just says this: Windows cannot access the file for one of the following reasons: there is a problem with the network connection, the disk that the file is stored on, or the storage drivers installed on this computer; or the disk is missing. Windows closed the program Setup.exe because of this error.

Here's the script (which is stored on \\WIN2K8R2-F-01\Remote Applications):

@ECHO OFF

IF DEFINED ProgramFiles(x86) (
    ECHO DEBUG: 64-bit platform

    SET _path="C:\Program Files (x86)\Canam"
) ELSE (
    ECHO DEBUG: 32-bit platform

    SET _path="C:\Program Files\Canam"
)

IF NOT EXIST %_path% (
    ECHO DEBUG: Folder does not exist

    PUSHD \\WIN2K8R2-PSA-01\PSA Data\Client

    START "" "Setup.exe" "/q"

    POPD
) ELSE (
    ECHO DEBUG: Folder exists
)

Running the script manually as administrator also results in the same error. Setting up a shortcut with the same target and parameters works perfectly. Manually calling the executable also works.

Not sure if it matters, but the installer is based on dotNETInstaller. I don't know what version though.

I'd appreciate any suggestions on fixing this. Thanks in advance!

UPDATE

I highly doubt this matters, but the network share that the script is hosted in is a shared drive, while the network share the script references for the executable is a shared folder.

Also, both shares have Domain Computers listed with full access for the sharing and security tabs. And PUSHD works without wrapping the path in quotes.

UPDATE 2

If I manually open CMD on the client machine and enter PUSHD "\\WIN2K8R2-PSA-01\PSA Data\Client" I get the directory mounted as a drive properly. If I then enter START "" "Setup.exe" "/q" the installer kicks in exactly as it should and it actually installs the application.

UPDATE 3

While doing some debugging through ECHO statements, I started outputting TXT files to the C:\ drive on the client machine. After I called PUSHD I ECHOed %CD% to see what the current directory was. It ended up outputting C:\Windows not {?}:\Client like it should if it succesfully mounted the remote directory.

I think it has something to do with the messages I get at the very top of the screen that UNC paths are not supported, blah blah blah, even though the rest of the script actually executes.

Still looking for suggestions on getting this to work.

Gup3rSuR4c
  • 661
  • 3
  • 14
  • 29
  • I think in the end you'll need to do both joequerty's and mdarras answers. – tony roth Oct 26 '12 at 03:08
  • For `PUSHD`, it works fine without the quotes and for the permissions, I already had `Domain Computers` added to both locations under sharing and security properties. – Gup3rSuR4c Oct 26 '12 at 04:19

4 Answers4

2

Sounds like a permission issue. If you're doing this in a startup script it will run as SYSTEM. You'll need to give Domain Computers read access to where the files are stored.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
MDMarra
  • 100,734
  • 32
  • 197
  • 329
  • That's what I thought as well, and already placed `Domain Computers` with full access for both sharing and security on both locations. – Gup3rSuR4c Oct 26 '12 at 04:19
2

Put quotes around the share path. You've got a space in the share name and I'm assuming that's what's causing the problem.

joeqwerty
  • 109,901
  • 6
  • 81
  • 172
  • I assume you're talking about the `PUSHD` part. I tested it in CMD on it's own and it works without the quotes. – Gup3rSuR4c Oct 26 '12 at 04:15
  • Whenever I've had a path with spaces in a script I've had to put quotes around it. Have you tried putting quotes around the path? You've got nothing to lose by trying it. – joeqwerty Oct 26 '12 at 04:42
  • I tried it just for the sake of trying and the end result is identical. – Gup3rSuR4c Oct 26 '12 at 14:48
2

Suggestions that might help you.

1)

You can use sysinternal's psexec to open a cmd window as SYSTEM for debugging "psexec \127.0.0.1 /s cmd" From there you can walk through the script "line by line" to see where it fails

2)

You can modify the script so it runs in the current dir with the "%~dp0" prefix

Have you tried skipping the START command?

PUSHD \WIN2K8R2-PSA-01\PSA Data\Client

%~dp0Setup.exe" "/q"

Fannar Levy
  • 161
  • 5
  • I tried what you suggested, but I'm getting this as an error: `... is not recognized as an internal or external command, operable program or batch file.` – Gup3rSuR4c Oct 26 '12 at 21:12
  • I... love you... So, I got rid of the `START` as you suggested and it just worked. Thanks! – Gup3rSuR4c Oct 26 '12 at 21:42
0

The problem is that you popd out before the setup finishes. This is because cmd starts the setup and immedeately goes on with the popd command.

Use start "" Setup.exe /wait /q

you can also use the UNC path. Maybe you need quotes.

start "Setup title" "\\server\share\folder\setup.exe" /q
syss
  • 123
  • 7