Script pour envoyer de fichier

Bonjour,
j’ai fait un petit script qui récupère la version windows installer sur certain machine, je cherche a continue a faire le script pour qu’il puisse envoyer les résultat ver une répertoire de stockage distant ( Nas ou autre) de tell façon je doit pas ouvrir chaque pc et récupérer le fichier pour mieux expliquer:
j’ai 5 pc qui ont un script dans une tache planifier ( je cherche un script qui s’exécute a partir d’une tache planifier et le résultat qui est un fichier csv doivent étre copier sur un serveur distant)

est que vous avez une idée ou des pistes.

Merci d’avance.

Hello,
I made a small script which gets the windows version installed on some machine, I try to continue to make the script so that it can send the results to a remote storage directory (Nas or other) in such a way I must not open each pc and recover the file to better explain:
I have 5 pc which have a script in a schedule task (I am looking for a script which runs from a schedule task and the result which is a csv file must be copied to a remote server)

i start to work with this but it dosent work, do i need to activate somethis on my nas or do i need to configure my lap before executing this script !?
<#$uri = “\server.domain.com\path\to\share”
Remove-PSDrive WebDavShare -Force -ea 0
New-PSDrive -Name WebDavShare -PSProvider FileSystem -Root $uri
Get-ChildItem WebDavShare:\
Copy-Item $fichierComplet "WebDavShare:"+fichier
#>
is that you have an idea or some leads.

Thank you in advance.

houssem
Bienvenue to the forum.

Even if there are some colleagues speaking french in this forum the general language is englsih. Could you please ask your question in english? :wink:

Thanks in advance.

Bonjour :wave:

Je pense que je comprends ton probleme mais mon français n’est pas bon assez pour repondre en français. Alors,

Writing the file back to a file share should be pretty easy. All you need to ensure is that the account running the scheduled task has access to write to the shared folder.

If you are having problems, please share some code and any error messages.

1 Like

thank you for your replay,
i write my problem in english too, the problem that im new to power shell and i dont know how to start, i was looking for webdav to share the file i had from my script but it was a bit complecated for me.
is theere an easier way to copy that file in a distance Nas !?
thank you in advance!

I’m not completely sure if I got what you’re trying to do but most (if not all) NAS appliances offer the the possibility to use SMB protocol. If you have a working DNS in your environment you can simply copy to or from a NAS by contacting it via “\\ServerName\Share

Most of the time it’s easier to improve existing code - even if it does not work as expected - than to make general recommendations. So you might post your code (formatted as code please) and I’m pretty sure someone will be able to help you further.

1 Like

thank you for your replay, actualy im a beginner in ps can you give me plus details if you dont mind.
thank you in advance.

Based on the code you have provided, I do believe you are complicating the issue. What it seems you want should be as easy as this providing the user running the script has permissions to $uri. Olaf has basically stated the same.

$uri = “\\server.domain.com\path\to\share”
Copy-Item $fichierComplet $uri
1 Like