Jump to content

probleme FileGetSize() avec RunAs


Recommended Posts

j'aimerais bien partager avec vous mon probleme avec la creation d'un scripte qui permet de comparer deux fichiers, le primier existe sur le serveur et le 2eme localement sur le pc client.

l'objectif de la comparison c'est d'ecraser le fichier qui existe sur le pc client par celui qui existe au serveur (en cas de la difference).

le probleme c'est que le fichier concerné existe dans un dossier (sur le serveur) qui est partagé en $ avec un seul utilisateur admin (avec un mot de passe).

alors comment je pourai reccuperer le FileGetSize() et FileGetVersion() depuis un dossier partagé en reseau sur le serveur avec des droits limités et sachant que RunAs ne lance que des programmes et non pas des fonctions?

voila mon scripte:

#include <FileConstants.au3>
#include <Constants.au3>

$srv = "serveurdossier$test.exe"
$loc = "d:folder"
$user = "user"
$domaine = "serveur"
$pass = "pass@@ssapl"
$flg = 2

 ; qu'est ce que je pourai mettre ici afin de executer le reste de scripte avec des droits d'administrateurs

 ;RunAs($user,$domaine,$pass, $flg, ...) >> je sais pas si ça va fonctionner ou non et comment?

      if not FileExists($srv) then
            MsgBox($MB_SYSTEMMODAL, "Erreur !", "File Serveur is not exist...")
         Else

            Local $iFileSize  = FileGetSize($loc)
            Local $iFileSize1  = FileGetSize($srv)

            Local $sFileVersion  = FileGetVersion($loc)
            Local $sFileVersion1 = FileGetVersion($srv)

            if $iFileSize <> $iFileSize1 Or $sFileVersion <> $sFileVersion1  then

               FileCopy($pcserveur ,$pcloc, 1)
               MsgBox($MB_SYSTEMMODAL, "msg !", "copie ")
            else
               MsgBox($MB_SYSTEMMODAL, "msg !", "non")
            endif
      EndIf

merci d'avance pour votre aide.

 

Link to comment
Share on other sites

Ce est un forum anglais, donc se il vous plaît utiliser Google Translate (comme je l'ai fait pour cela) , pour poster une version anglaise de votre sujet .

Toutefois, si ce est une question que vous avez déposé pour obtenir hel avec le code , vous l'avez fait dans la mauvaise partie du forum . Dans ce cas, vous devriez avoir utilisé général Aide & Support ou GUI Aide .

 

This is an English forum, so please use Google Translate (like I did for this), to post an English version of your topic.

If however, this is a question you have posted to get help with code, you have done so in the wrong part of the forum. In that case you should have used General Help & Support or GUI Help.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

[i hope it's understandable !!]

I'd like to share with you a problem I've encountered when I was creating a script, who has to compare two files. Le first is located on a server, the second on a client PC.

The point of this comparison is to delete the client PC file and replace it by the server one, if the files are different.

My problem is that the concerned file is located in the server in a folder who's shared with a "$" [Translation note : so it's a "full drive" sharing ?] with only one administrator user (with password).

In this context, how can I get the filegetsize() and filegetversion() information, with limited rights and knowing that runas only permit admin granting on program and not functions ?

Here's my script :

#include <FileConstants.au3>
#include <Constants.au3>

$srv = "serveurdossier$test.exe"
$loc = "d:folder"
$user = "user"
$domaine = "serveur"
$pass = "pass@@ssapl"
$flg = 2

 ; qu'est ce que je pourai mettre ici afin de executer le reste de scripte avec des droits d'administrateurs

 ;RunAs($user,$domaine,$pass, $flg, ...) >> je sais pas si ça va fonctionner ou non et comment?

      if not FileExists($srv) then
            MsgBox($MB_SYSTEMMODAL, "Erreur !", "File Serveur is not exist...")
         Else

            Local $iFileSize  = FileGetSize($loc)
            Local $iFileSize1  = FileGetSize($srv)

            Local $sFileVersion  = FileGetVersion($loc)
            Local $sFileVersion1 = FileGetVersion($srv)

            if $iFileSize <> $iFileSize1 Or $sFileVersion <> $sFileVersion1  then

               FileCopy($pcserveur ,$pcloc, 1)
               MsgBox($MB_SYSTEMMODAL, "msg !", "copie ")
            else
               MsgBox($MB_SYSTEMMODAL, "msg !", "non")
            endif
      EndIf

Thanks in advance for your help.

Link to comment
Share on other sites

  • Moderators

GhostLine,

Are you and technicoman the same person? We do not permit multiple accounts here so if that is the case I will merge the 2 into the Ghostline account. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

GhostLine,

Compris! :)

[Understood]

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

M23 xD

I guess i can help this frensh guy in pm :) if he cant speack english.

Je pense pouvoir aidé cette personne en privé. si il ne parle pas anglais.

and i guess i know how to solve his probleme.

Et je crois que je sais geré ton probleme .

but plz know: in all case you need an account with the rights to do that. (!!!!!!!!! If you use account password and Id in script you can lost your work for that in france care!!!!!!)

mais sache que dans tout les cas tu ddois executé le script avec un compte qui disposes des droits. (!!!!mais fait gaf utilisé les mots de passe et id dans ton script peux te faire perdre ta place en france!!!!!!)

Veuille a faire validé ta démarche avant tout.

================================================================================

1)As a start you can runas explorer.exe with the atribut /separate 

1)Pour commencé tu peux simplement lancé explorer.exe avec l'atribut /separate

Or

2)RunAs cmd with admin right and then type explorer.exe /separate so you will be able to do admin task from there (or normal task that need rights)

2)RunAs cmd avec les droits admin et ecris explorer.exe /separate alors tu pourra faire des tache admin. (ou des opération normal mais avec des droits)

 

after all all depend of the logic you will use...

Tout dependra de la logique que tu utiliseras....

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

M23 xD

I guess i can help this frensh guy in pm :) if he cant speack english.

Je pense pouvoir aidé cette personne en privé. si il ne parle pas anglais.

and i guess i know how to solve his probleme.

Et je crois que je sais geré ton probleme .

but plz know: in all case you need an account with the rights to do that. (!!!!!!!!! If you use account password and Id in script you can lost your work for that in france care!!!!!!)

mais sache que dans tout les cas tu ddois executé le script avec un compte qui disposes des droits. (!!!!mais fait gaf utilisé les mots de passe et id dans ton script peux te faire perdre ta place en france!!!!!!)

Veuille a faire validé ta démarche avant tout.

================================================================================

1)As a start you can runas explorer.exe with the atribut /separate 

1)Pour commencé tu peux simplement lancé explorer.exe avec l'atribut /separate

Or

2)RunAs cmd with admin right and then type explorer.exe /separate so you will be able to do admin task from there (or normal task that need rights)

2)RunAs cmd avec les droits admin et ecris explorer.exe /separate alors tu pourra faire des tache admin. (ou des opération normal mais avec des droits)

 

after all all depend of the logic you will use...

Tout dependra de la logique que tu utiliseras....

 

Thank you SIR for your help I can say that you have put me in the right direction I will try to advance on the script.

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
 Share

  • Recently Browsing   0 members

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