Git Product home page Git Product logo

psdiskpart's Introduction

Build status

DiskPart PowerShell Module

This is a PowerShell module for working with DiskPart. Newer Operating Systems include many commands to replace DiskPart; unfortunately, these have not been extended to down-level operating systems.

Please be wary and read through this before using it. While it works in my environment, you know the risks of working with diskpart.

Contributions to improve this would be more than welcome!

Caveats:

  • Minimal testing. Not something you want to hear with DiskPart.

#Functionality

Get DISK information:

  • Get DISK information

Get VOLUME information:

  • Get VOLUME information

Offline a disk

  • Offline a disk

Online a disk

  • Online a disk

#Instructions

# One time setup
    # Download the repository
    # Unblock the zip
    # Extract the PSDiskPart folder to a module path (e.g. $env:USERPROFILE\Documents\WindowsPowerShell\Modules\)

# Import the module.
    Import-Module PSDiskPart    #Alternatively, Import-Module \\Path\To\PSDiskPart

# Get commands in the module
    Get-Command -Module PSDiskPart

# Get help for a command
    Get-Help Get-DiskPartDisk -Full

# Get details about disks on the local computer and c-is-hyperv-1
    Get-DiskPartDisk -computername $ENV:COMPUTERNAME, c-is-hyperv-1

# Run a DiskPart script on SERVER1145, set disk 2 to online, clear the readonly attribute if it exists
# Mind the here string.  Ugly formatting necessary!
    
Invoke-DiskPartScript -ComputerName SERVER1145 -DiskPartText @"
select disk 2
online disk
attributes disk clear readonly
"@

#Notes

  • Thanks to Adam Conkle for the disk part parsing pieces.
  • This was written as a component to help simplify migrating to the Paravirtual SCSI Controller. I've seen disks come up offline more often than not.
  • Accompanying blog post (pretty much the stuff above, with more rambling)
  • TODO: More Pester tests
  • TODO: Refactor some of the DiskPart parsing. For example, PowerShell users might expect 'Yes' to be true, 'no' to be false
  • TODO: Add parameters to Get commands. For example, one should be able to get a specific disk, or limit output to 'list disk', rather than force 'detail disk'.

psdiskpart's People

Contributors

ramblingcookiemonster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.