Jump to content
Sign in to follow this  
res2cpu

Odd problems with file copy and vista

Recommended Posts

res2cpu

Hi,

Im having problems with windows vista copying a file over a network. On windows xp the code works with no problems and copies at full speed (70-90% of the network bandwidth) on vista it copies very slowly (avg of 2.5% of the network bandwidth). I have found out whats causing the issue but am unable to find a fix.

First of all here is the code as it stands,

_mapcheck ()
If @OSVersion = "WIN_XP" Then
    If @OSServicePack <> "Service Pack 3" Then
        MsgBox(4096, "Update Needed", "This computer does not have the correct service pack.  This will be installed now.", 10)
        if @OSArch = "X64" Then
            $arch = "64"
            $inst = 0
        Else 
            $arch = "32"
            $inst = 1
        EndIf
        if $inst = 1 then
            TrayTip("Wsus Linker", "Installing Windows Service Pack.  Please Wait....", 10, 1)
            Do 
                ;FileCopy ( "\\susserver\link\service_packs\xp\sp3_" & $arch & ".exe" , @TempDir & "\sp3.exe", 9 )
                $FileCopy = _CopyWithProgress("\\susserver\link\service_packs\xp\sp3_" & $arch & ".exe", @TempDir & "\sp3.exe", 2048)
                Sleep ( 5000 )
            Until FileGetSize ( "\\susserver\link\service_packs\xp\sp3_" & $arch & ".exe" ) = FileGetSize ( @TempDir & "\sp3.exe" )
            Sleep ( 2000 )
            RunWait ( @TempDir & "\sp3.exe /passive /norestart" )
            Shutdown ( 2 )
            Exit
        EndIf
    endif
ElseIf @OSVersion = "WIN_VISTA" Then
    If @OSServicePack <> "Service Pack 2" Then
        If @OSServicePack = "Service Pack 1" Then $sp = "sp2_"
        If @OSServicePack = "" Then $sp = "sp1_"
        MsgBox(4096, "Update Needed", "This computer does not have the correct service pack.  This will be installed now.", 10)
        TrayTip("Wsus Linker", "Installing Windows Service Pack.  Please Wait....", 10, 1)
        if @OSArch = "X64" Then
            $arch = "64"
        Else 
            $arch = "32"
        EndIf
        Do 
            ;FileCopy ( "\\susserver\link\service_packs\vista\" & $sp & $arch & ".exe" , @TempDir & "\spinst.exe", 9 )
            $FileCopy = _CopyWithProgress("\\susserver\link\service_packs\vista\" & $sp & $arch & ".exe", @TempDir & "\spinst.exe", 2048)

            Sleep ( 5000 )
        Until FileGetSize ( "\\susserver\link\service_packs\vista\" & $sp & $arch & ".exe" ) = FileGetSize ( @TempDir & "\spinst.exe" )
        Sleep ( 2000 )
        RunWait ( @TempDir & "\spinst.exe /unattend /forcerestart" )
        Shutdown ( 2 )
        Exit
    EndIf
EndIf

Func _mapcheck ()
        do 
            _RunDOS ( "net use \\susserver /user:link nubbin" )
            sleep ( 2000 )
        Until FileExists ( "\\susserver\link" )
EndFunc

I have tried DriveMapAdd to authenticate with the server but i found that vista still had a problem and would "drop" the drive map.

The issue seems to be the vista machine is forgetting its connection to the server. I have tried to browse the server by putting "\\susserver\" into a run dialog box for it to ask me for a username and password.

I have tested that authentication is the problem running this:

#include <Process.au3>

do 
    _RunDOS ( "net use \\susserver /user:link nubbin" )
    sleep ( 2000 )
Until FileExists ( "\\susserver\link" )
MsgBox(4096, "Test", "Done" )

Then re-running the program to copy the file, at that point it copies the file with no problems at full speed.

Can anyone help with this?

Share this post


Link to post
Share on other sites
DW1

instead of looping through the net use repeatedly why not just include one in your script before the transfer?

you can use either "/savecred" or "/Persistent:yes" and see if that works without a need to loop.

I tried to repro the issue, but it is working fine for me in my VM.

Share this post


Link to post
Share on other sites
res2cpu

The server is a win2003 box which runs the windows software update services. Im not sure if its a vista --> win2003 thing.

The code i posted is part of a much larger program that wont start till it connects to the server and checks itself to see if it has any updates, that all works fine.

Im not at work at the moment but ill give it a try when im next in on sunday.

Thanks for the idea

Share this post


Link to post
Share on other sites
res2cpu

I have tried the "/savecred" or "/Persistent:yes", these have had no effect. Does anyone have any other ideas?

I have tired getting the program to run another set of script (auth.exe) which is:

#include <Process.au3>
If FileExists ( "\\susserver\link\link_files\auth.exe" ) = 0 Then
    do 
        _RunDOS ( "net use \\susserver /user:link nubbin" )
        sleep ( 2000 )
    Until FileExists ( "\\susserver\link\link_files\auth.exe" )
EndIf

The program still has the same problem of copying slowly, i have monitored the server shares while the program is running and the server is saying that the computer running the code is connected and has a file open in read mode, Yet if i try and browese the server shares im am asked for a username and password. Confused? I am...

Can anyone help?

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.