Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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 is 10.10.10.10 is remote host where we need to run Get-PSRemoting command

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.