Hiding Diskpart window & Capturing output.


hello everyone,

i have users need have vhd connected local mount point when logon vm. works ok @ moment straightforward batch file, want move ps

a) stop new console window appearing diskpart output, ,

b) capture diskpart output text file each user (and add more error checking etc later in script)

at moment work expected when local admin logs on (ie no console, , output file), normal user still opens new console window diskpart. create the diskpartoutput.txt file, not redirect diskpart output file. (nb diskpart run ok normal users, have given users access run it)

write-host "`n attaching vhds..."
start-process diskpart.exe -argumentlist "/s \\networkshare\config\diskpart.txt" -redirectstandardoutput $uservhomeshare\diskpartoutput.txt -wait -nonewwindow

it has wait until diskpart has finished before continuing script, vhd's contain sql data needed next step starts sql services...

any ideas gratefully appreciated :-)

david.

to mount vhd powershell mount it.  there no need use diskpart.

mount-vhd -path c:\test\testvhdx.vhdx


¯\_(ツ)_/¯



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607