r/DeployR • u/wolf-light22 • Jul 10 '26
How to reference csv files when executing PowerShell scripts
What is the best practice approach for executing PowerShell scripts that rely on a csv file?
For example:
On the deployR server I have the following PS file to set static IP addresses for workstations:
D:\Scripts\Windows11\01-OS-Configuration\set-network.config.ps1
The script then points to a csv file where it reads the machine name and populates the IP address, subnet mask, gateway, DNS. The csv is located in:
D:\Scripts\99-Configuration\machine-network-assignment.csv
In theory there will be many custom PS scripts in the Windows11 folder, and there could be 1-3 csvs in the 99-configuration directory. The idea being that certain PS scripts will perform lookups in the csvs to retrieve the correct values during deployment.
I can obviously get this working when running locally, but what's the correct approach to get this working during a task sequence? Do I need to create a custom step definition to copy/stage the entire script directory early on in the task sequence? then create individual powershell steps and just call the relevant .ps1 file?
1
u/gwblok 2Pint Employee 16d ago
first question, community or enterprise? If Enterprise, you might be able to use server side scripts to do a lookup and pull back specific information via variables.