Loading...

Powershell Tool : Run "Export my Config" to choose the output format

Reply A+ A-

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 ?
  1. The script contains four functions (CSV, CSV_XLS, HTML and XML) which export the configuration in specific format.
  2. Function CSV exports configuration to CSV
  3. Function CSV_XLS formats CSV to XLS
  4. Function HTML exports configuration to HTML
  5. Function XML exports configuration to XML
  6. It will create a folder called "export-config" on your Desktop
  7. 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 :

Run the below commandline :

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 :
  1. Copy the file "Export_config_Choice.ps1" in your "Deploy\Scripts" folder.
  2. Copy the file "export-config.css" in "Deploy\$OEM$\$1"
  3. In your Task sequence, Add a new CommandLine
  4. 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 }"


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







Windows 2821973762925457995

Enregistrer un commentaire

Accueil item

Award

Sponsors

Learn KQL in one month

You want to support me ?

Mes articles en français

Books in French


Stats