File copy permissions issue

File copy permissions issue

kstate92
Collaborator Collaborator
1,086 Views
7 Replies
Message 1 of 8

File copy permissions issue

kstate92
Collaborator
Collaborator

To my amazement, it only took me two weeks of Googling and amateurish hacking to convert an existing VB6 program to a VB.Net equivalent.  It is functioning correctly, except for the formerly trivial last step.

 

The program basically finds or creates a plt file and then copies it to the queue of a large format Xerox printer.  This has worked without issue in 32bit XP, but in 64bit Win 7, I get permission errors during the file copy action.  Using the Scripting method, I get System.Security.SecurityException CTL_E_PERMISSIONDENIED.  Trying System.IO.File.Copy, I instead get System.UnauthorizedException mscorlib.dll Access the to path is denied.

 

As a test, I ran the command line equivalent (COPY foo.plt networkprintername).  In XP, I received a print out as expected; in Win 7, the return line is 'Access is denied. 0 file(s) copied.'  What is interesting is if I have that printers' queue window open when I send the command line test, an entry briefly appears and disappears with a Document Name starting with the word 'Remote'.

 

So far, neither I nor IT can figure out a permissions workaround for this; just curious if anyone else had run into this same problem.

KState92
Inventor Professional 2020
AutoCAD Mechanical 2022.0.1
Windows 10 Pro 64 bit - 1903
Core i7-8700 32 GB Ram
Quadro P2000
0 Likes
1,087 Views
7 Replies
Replies (7)
Message 2 of 8

fieldguy
Advisor
Advisor

I can think of 2 possible workarounds, but both require more info on your Xerox.  I have used FTP and LPR on HP and KIP devices successfully, but not so much success with Seiko (current problem).  HP allows generic access to ftp - the others seem to require a legitimate username and password but don't always make those easy to find.

 

This only works if the printer has a built in print processor that supports generic formats.

Here's a link to LPR for Xerox (http://www.office.xerox.com/userdoc/P750/resource/network.12.html)

 

 

0 Likes
Message 3 of 8

dgorsman
Consultant
Consultant

Just a WAG: this might be related to the current UAC setting.  That can get in the way of certain automated processes (as it is designed to do), especially with relation to permissions to do things in certain local and a lot of remote folder locations.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 4 of 8

kstate92
Collaborator
Collaborator

That occured to the IT guy too.  I recall him setting the UAC to nothing whilst remoted-in to my box with no success.

KState92
Inventor Professional 2020
AutoCAD Mechanical 2022.0.1
Windows 10 Pro 64 bit - 1903
Core i7-8700 32 GB Ram
Quadro P2000
0 Likes
Message 5 of 8

Mikko
Advocate
Advocate

I've done this and its worked:

 

Dim myProcess As New Process

Dim thisPrinter As String = "TheOneWhoseDriversCreatedThePLT"

Dim someFile As String = "c:\temp\somefile.plt"

Dim arg = "/C COPY /B " & Chr(34) & someFile & Chr(34) & " " & thisPrinter & " && exit"

myProcess.StartInfo.FileName = "cmd.exe"

myProcess.StartInfo.Arguments = arg

myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden

myProcess.StartInfo.CreateNoWindow = True

myProcess.Start()

myProcess.WaitForExit(1000)

If Not myProcess.HasExited Then

myProcess.Kill()

End If

myProcess.Close()

 

Your mileage my vary....

0 Likes
Message 6 of 8

kstate92
Collaborator
Collaborator

Huh.  I tried this snippet of code and... nothing.  No print, but also no error or exception written out (I wrapped the MyProcess.Start() in a Try-Catch block).

 

The only thing that happens is a brief entry in the network printer queue titled "Remote Downlevel Document" with Status of Spooling, my Windows username as the Owner, Pages of N/A while Size, Submitted, and Port remains blank.

KState92
Inventor Professional 2020
AutoCAD Mechanical 2022.0.1
Windows 10 Pro 64 bit - 1903
Core i7-8700 32 GB Ram
Quadro P2000
0 Likes
Message 7 of 8

jeff
Collaborator
Collaborator

Can it print in 1000 milliseconds?

 

WaitForexit(1000)

 

You can also find your answers @ TheSwamp
0 Likes
Message 8 of 8

kstate92
Collaborator
Collaborator

With MyProcess.StartInfo

                    .FileName ="cmd.exe"

                    .Arguments = strArg

                    .WindowStyle =ProcessWindowStyle.Hidden

                    .CreateNoWindow =True               

EndWith

               

Try

                    MyProcess.Start()

               

Catch er AsException

                   

Console.WriteLine(er)

               

EndTry

                MyProcess.WaitForExit(1500) 'this is what I already had it set to

 

The Swamp - I've never understood forum sites that forbid searching without having an account.  Guess I'll have to sign up.

KState92
Inventor Professional 2020
AutoCAD Mechanical 2022.0.1
Windows 10 Pro 64 bit - 1903
Core i7-8700 32 GB Ram
Quadro P2000
0 Likes