il-fede - Fotolia
I have three client machines A, B and C, which are connected to the Internet and use Microsoft operating systems. I have a server X, which runs Windows Server 2008 R2. I want to create an architecture where all three clients have a folder accessible to the server. Is there a way I can send a .csv file to the client machine shared folder and open it using Excel from the server X? The clients A, B and C do not have static IP address, but as they are connected to the server by an application, I have their dynamic IP addresses. My server X has a static IP address.
There are several file sharing setups; here are the easiest and most basic options, from a file sharing server to workstation-based options.
One consideration to make around your approach would be to create a file share on the server, put the CSV file in that share and allow the clients access to it. You may have reasons for wanting a copy on each client rather than a file sharing server, so I'll suggest that alternative as well.
If the three clients and server are all standalone workstations and not part of an Active Directory environment, you'll have to grant permissions manually. Create an administrator account on all workstations with a password, so you can control all clients from your server. Make the passwords all the same to keep things simple, but consider changing them on a regular basis for security reasons.
You should be able to use the workstation names in this file sharing setup if your DHCP server is running on your router for Internet connection. Try to ping one workstation from another and see if it resolves the name to the IP address. If you cannot do this, reset your clients to have static IP addresses that you can use.
Now, use the administrator account to copy your .csv file. You can remotely access the drive of each workstation through the path \\workstationname\c$ -- assuming C:\ is where Windows is installed -- and copy the file to where you want. You can script this using the copy command.
For example, use copy c:\data.csv \\workstationname\c$\destination\ -- and an extra line for each workstation. Then save it into a batch file, creating a Windows scheduled task to run when you like. You can specify the username and password in the batch file, but to be more secure, add the details to the Windows Credential Manager so it can use the cached credentials instead.
Lastly, tell Excel to launch and open the .csv file, issuing the command from the server. This is harder than you'd expect. You could create a scheduled task and then trigger it with the built-in schtasks program. The scheduled task needs to be created on each workstation, using the script:
schtasks.exe /create /s workstationname /tn "Excel" /tr "C:\Program Files (x86)\Microsoft Office\Office14\Excel.exe C:\destination\data.csv"/sc ONCE /sd 01/01/1910 /st 00:00
This will create a scheduled task called Excel, launching excel.exe and opening data.csv.
Then, trigger Excel to run and the .csv file to open with schtasks.exe /run /s workstationname /tn "Excel"
The task may get stuck, which will require you to end the task before running again, using schtasks.exe /end /s workstationname /tn "Excel"
Editor's note: The PSexec tool requires credentials and therefore doesn't work in this particular scenario for the asker's file sharing server.
PowerShell remoting comes to Windows Server 2008 R2
Application compatibility in the Windows Server OS
Learn about DNS devolution
Dig Deeper on Scripting, Scheduling and IT Orchestration
Related Q&A from Adam Fowler
While basic monitoring services and feedback loops provide critical insight for DevOps teams, an end-to-end monitoring tool gives them a more ... Continue Reading
Outlook crashes and rendering issues might require an upgrade -- or a downgrade -- for administrators who want to avoid a Band-Aid approach and want ... Continue Reading
I have nothing but an IT help desk email inbox, and deployment management is organized chaos. It works well enough to keep the business running, but ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.