.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

File copy permissions issue

7 REPLIES 7
Reply
Message 1 of 8
kstate92
786 Views, 7 Replies

File copy permissions issue

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
7 REPLIES 7
Message 2 of 8
fieldguy
in reply to: kstate92

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)

 

 

Message 3 of 8
dgorsman
in reply to: kstate92

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.


Message 4 of 8
kstate92
in reply to: dgorsman

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
Message 5 of 8
Mikko
in reply to: kstate92

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....

Message 6 of 8
kstate92
in reply to: Mikko

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
Message 7 of 8
jeff
in reply to: kstate92

Can it print in 1000 milliseconds?

 

WaitForexit(1000)

 

You can also find your answers @ TheSwamp
Message 8 of 8
kstate92
in reply to: jeff

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost