locked
invoke-command diskpart RRS feed

  • General discussion

  • Is there a way to remotelyt extend a C drive with invoke-command?
    • Changed type Bill_Stewart Tuesday, April 14, 2020 5:19 PM
    • Moved by Bill_Stewart Tuesday, April 14, 2020 5:20 PM Help vampire
    Thursday, December 5, 2019 3:27 PM

All replies

  • You've posted here before, so you should know this already. But in case you've forgotten, please read the following post. It is right at the top of this forum:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Thursday, December 5, 2019 3:34 PM
  • ok got it working

    incase anyone interested

    get-content "c:\temp\vms.txt" | % { copy-item -path "c:\temp\diskpart.txt" -destination "\\$_\c$\temp" }

    $scriptblock = {diskpart /s "c:\temp\diskpart.txt"}

    foreach ($vm in (get-content "c:\temp\vms.txt")) {

    invoke-command -computername $vm -scriptblock $scriptblock

    }

    diskpart.txt is 

    ---------

    rescan

    select volume c

    extend

    Thursday, December 5, 2019 8:58 PM