Powershell Tool : Run "Export my Config" to choose the output format
https://www.systanddeploy.com/2014/08/powershell-tool-run-export-my-config.html
In my previous post, I have shown a little tool which allows to export your configuration (services, hotfix, software, drivers & process) to multiple format as CSV, XLS, HTML and XML.
I have been asked if it would be possible to run the script to export configuration just in some specific format and also run it with MDT.
That's why I have modified the ps1 to allow this behavior.
How it works ?
- The script contains four functions (CSV, CSV_XLS, HTML and XML) which export the configuration in specific format.
- Function CSV exports configuration to CSV
- Function CSV_XLS formats CSV to XLS
- Function HTML exports configuration to HTML
- Function XML exports configuration to XML
- It will create a folder called "export-config" on your Desktop
- It will create a folder called CSV or XML or HTML depending of the ouput format you have choose.
How to use it ?
A / Run the script normally :
powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -command "& { . %your_ps1_folder%\Export_config_Choice.ps1; %format expected% }"
%your_ps1_folder% : Location where you have copied the file "Export_my_config_Choice.ps1".
%format expected% : Output format you need (CSV, HTML or XML).
Example : powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -command "& { . c:\Export_my_config_Choice.ps1; CSV }"
B / To run the script with MDT :
- Copy the file "Export_config_Choice.ps1" in your "Deploy\Scripts" folder.
- Copy the file "export-config.css" in "Deploy\$OEM$\$1"
- In your Task sequence, Add a new CommandLine
- Copy the below commandline in the commandline field
powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -command "& { . %SCRIPTROOT%\Export_config_Choice.ps1; %format expected% }"
%format expected% : is the output format you need (CSV, CSV_XLS, HTML or XML).
Example : powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -command "& { . c:\Export_config_Choice.ps1; CSV_XLS }"
%format expected% : is the output format you need (CSV, CSV_XLS, HTML or XML).
Example : powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -command "& { . c:\Export_config_Choice.ps1; CSV_XLS }"
Step 2 : Copy "Export-config.css" in "Deploy\$OEM\$1" |
Step 3 : Add a new commandline in your Task sequence |
Step 4 : Copy the commandline in the commandline field |
Enregistrer un commentaire