Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Windows XP SP3, how can I extend a volume using Powershell on a remote computer?

I prefer WMI over Powershell remoting.

share|improve this question
up vote 2 down vote accepted

On my local computer I would do this by piping the commands to diskpart:

PS> $a = "select disk 0","select volume 0","extend" | diskpart
PS> write-host $a

Maybe you can build on this to achieve the desired result on the remote computer

share|improve this answer
    
Current solution: Invoke-Command -ComputerName $compName -Credential $compCred -ScriptBlock {"rescan","select volume 2","extend" | diskpart} – Primoz Jan 27 '11 at 8:35
    
Thanky you very much for your inspiring answer. – Primoz Jan 27 '11 at 8:36
$pass = convertto-securestring "p@$$w0rd" -asplaintext -force

$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist "10.10.10.10\Administrator",$pass

Invoke-Command -ComputerName 10.10.10.10 -Credential $myCred -ScriptBlock {"rescan","select volume 2","extend" | diskpart}

______________________________________________________________________________-

Where 10.10.10.10 is the remote host where we need to run the Get-PSRemoting command.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .