Disassembler0 / Win10-Initial-Setup-Script

PowerShell script for automation of routine tasks done after fresh installations of Windows 10 / Server 2016 / Server 2019
MIT License
4.7k stars 1.08k forks source link

Added call variant with output redirection in .cmd #207

Closed Zweikeks closed 5 years ago

Zweikeks commented 5 years ago

Alternative way to call the script. Stdout and stderr is redirected with Tee-object. Added as a comment/hint for people who wants to use it that way.

It requires Default.cmd to be already started as admin. RequireAdmin does not work. Tested with Win7 64bit, PowerShell 2.0 and Win10 1809 64bit, PowerShell 5.1. Handles spaces in pathes and file names.

Disassembler0 commented 5 years ago

It requires Default.cmd to be already started as admin

This is unfortunately a pretty big limitation, so I've implemented logging as optional command line -log parameter. Windows generally can't redirect output of privileged process to unprivileged one (at least not with /runas), so it doesn't achieve the exact same as your PR, but if the ultimate goal is to have a transcript of the script output, then it gets the job done.