{"action":"created","issue":{"url":"https://api.github.com/repos/PlagueHO/LabBuilder/issues/58","repository_url":"https://api.github.com/repos/PlagueHO/LabBuilder","labels_url":"https://api.github.com/repos/PlagueHO/LabBuilder/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/PlagueHO/LabBuilder/issues/58/comments","events_url":"https://api.github.com/repos/PlagueHO/LabBuilder/issues/58/events","html_url":"https://github.com/PlagueHO/LabBuilder/issues/58","id":134503313,"number":58,"title":"Create Initialize-VHD Function","user":{"login":"PlagueHO","id":7589164,"avatar_url":"https://avatars.githubusercontent.com/u/7589164?v=3","gravatar_id":"","url":"https://api.github.com/users/PlagueHO","html_url":"https://github.com/PlagueHO","followers_url":"https://api.github.com/users/PlagueHO/followers","following_url":"https://api.github.com/users/PlagueHO/following{/other_user}","gists_url":"https://api.github.com/users/PlagueHO/gists{/gist_id}","starred_url":"https://api.github.com/users/PlagueHO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlagueHO/subscriptions","organizations_url":"https://api.github.com/users/PlagueHO/orgs","repos_url":"https://api.github.com/users/PlagueHO/repos","events_url":"https://api.github.com/users/PlagueHO/events{/privacy}","received_events_url":"https://api.github.com/users/PlagueHO/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PlagueHO/LabBuilder/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"PlagueHO","id":7589164,"avatar_url":"https://avatars.githubusercontent.com/u/7589164?v=3","gravatar_id":"","url":"https://api.github.com/users/PlagueHO","html_url":"https://github.com/PlagueHO","followers_url":"https://api.github.com/users/PlagueHO/followers","following_url":"https://api.github.com/users/PlagueHO/following{/other_user}","gists_url":"https://api.github.com/users/PlagueHO/gists{/gist_id}","starred_url":"https://api.github.com/users/PlagueHO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlagueHO/subscriptions","organizations_url":"https://api.github.com/users/PlagueHO/orgs","repos_url":"https://api.github.com/users/PlagueHO/repos","events_url":"https://api.github.com/users/PlagueHO/events{/privacy}","received_events_url":"https://api.github.com/users/PlagueHO/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2016-02-18T07:34:17Z","updated_at":"2016-02-18T23:25:05Z","closed_at":null,"body":"Use:\r\n```powershell\r\n<#\r\n.SYNOPSIS\r\n    This function will determine if the mounted VHDx passed in DataPath is\r\n    in a state that it can be written to.\r\n    \r\n    It checks that the disk has been paritioned and that it contains a volume\r\n    that has been formatted.\r\n    \r\n    If the Fix switch is set it will fix the problems and put the disk into a\r\n    state it can be written to.\r\n#>\r\nfunction Test-DiskWriteStatus\r\n{\r\n    [OutputType([Boolean])]\r\n    [CmdletBinding()]\r\n    Param (\r\n        [String] $DiskPath,\r\n        \r\n        [Switch] $Fix,\r\n        \r\n        [String] $PartitionStyle = 'GPT',\r\n        \r\n        [String]\r\n    )\r\n    \r\n    # Check partition style\r\n    $DiskNumber = (Get-DiskImage -ImagePath $DiskPath).DiskNumber \r\n    if ((Get-Disk -Number $DiskNumber).PartitionStyle -eq 'RAW')\r\n    {\r\n        if ($Fix)\r\n        {\r\n            Initialize-Disk `\r\n                -Number $DiskNumber `\r\n                -PartitionStyle $PartitionStyle             \r\n        }\r\n        else\r\n        {\r\n            return $False\r\n        }\r\n    }\r\n    \r\n    # Check for a partition\r\n    $Partitions = Get-Partition -DiskNumber $DiskNumber -ErrorAction SilentlyContinue\r\n    if (-not ($Partitions))\r\n    {\r\n        if ($Fix)\r\n        {\r\n            \r\n        }\r\n        else\r\n        {\r\n            return $false\r\n        }\r\n    } \r\n    # Ok to write\r\n    return $true\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/PlagueHO/LabBuilder/issues/comments/185978277","html_url":"https://github.com/PlagueHO/LabBuilder/issues/58#issuecomment-185978277","issue_url":"https://api.github.com/repos/PlagueHO/LabBuilder/issues/58","id":185978277,"user":{"login":"PlagueHO","id":7589164,"avatar_url":"https://avatars.githubusercontent.com/u/7589164?v=3","gravatar_id":"","url":"https://api.github.com/users/PlagueHO","html_url":"https://github.com/PlagueHO","followers_url":"https://api.github.com/users/PlagueHO/followers","following_url":"https://api.github.com/users/PlagueHO/following{/other_user}","gists_url":"https://api.github.com/users/PlagueHO/gists{/gist_id}","starred_url":"https://api.github.com/users/PlagueHO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlagueHO/subscriptions","organizations_url":"https://api.github.com/users/PlagueHO/orgs","repos_url":"https://api.github.com/users/PlagueHO/repos","events_url":"https://api.github.com/users/PlagueHO/events{/privacy}","received_events_url":"https://api.github.com/users/PlagueHO/received_events","type":"User","site_admin":false},"created_at":"2016-02-18T23:25:05Z","updated_at":"2016-02-18T23:25:05Z","body":"I've added the first version of the function here:\r\n\r\nhttps://github.com/PlagueHO/LabBuilder/blob/Issue-58-Add-Initialize-VHD-Function/LabBuilder/LabBuilder.psm1#L248\r\n\r\nIt is not finished or tested."}}