UNSOLVED snapin query resizing partitions

  • I want to run this script to resize images to the full size of the drive as a snapin buts its got 2 parts. Never used the snap in before.

    How should i do it.

    first part vbs script.

    ########## Extend Disk Partition (MAX) ##########
    'LogFilename = "C:\Windows\Setup\InstallLog.txt"
    'LogFile.writeline "-------------------------------"
    'LogFile.writeline "Extending partition to max size:"
    'LogFile.writeline "-------------------------------" & VbCrlf
    diskpartScript = "c:\extend_max.txt"
    Set oShell = CreateObject("Wscript.Shell")
    Set oShellExec = oShell.Exec("cmd /c diskpart -s " & diskpartScript)
    set oStdOutputText = oShellExec.StdOut
    Do While Not oStdOutputText.AtEndOfStream
    diskpartOutput = oStdOutputText.ReadLine
    'LogFile.writeline diskpartOutput

    second part is a txt file. extend_max.txt"

    select disk 0
    detail disk
    list disk
    select volume c
    extend disk 0
    list disk
    1. can i use a snpain to copy extend_max.txt and then vbs to run to an image after its imaged
    2. how will it run it then?

    apologies for my ignorance on snapins.

  • Moderator

    @irishfoguser Hi, generally speaking you’re better off using Resizable image. If this for some reason doesn’t work (fails to deploy), then trying the other options is recommended.

    For your situation, it sounds like Resizable Image will do the trick. So I recommend picking an image, setting it to resizable, recapture, deploy and see if it works for you.

    1.3 is able to resize the correct partition for you before Windows even boots for the first time.

  • @Tom-Elliott can you elaborate more.

    most of my images are windows 7/8/10 and therefore are multi partition images.
    so i use the option multiple partition image - single disk not resizeable.

    Am i doing something wrong, I was given the admin of the server when someone left and thats what i was told what to do. the old server is 0.32 and the new one i have built myself is 1.3.0.

  • Fog supports re-sizable disks natively without any extra software installed in your image or any extra scripting post-imaging. This is the easiest way to solve the problem of mismatching disk sizes. I would advise against any custom solution. When you create your image in FOG, use the default which is “single disk - resizable”. This is pictured below.

    0_1483586768042_Resizable images.png

  • Moderator

    I can’t speak for snapins (don’t use them). But you should be able to bundle files with a snapin in addition to the vbscript code.

    Looking at your vbscript code this line raised a question

    Set oShellExec = oShell.Exec("cmd /c diskpart -s " & diskpartScript)

    diskpart is an exe not a batch script, so the cmd /c is extra. I might suggest

    Set oShellExec = oShell.Exec("diskpart -s " & diskpartScript)

    Also before fog supported resizeable disks I used a script similar. It was a simple added at the end of the setupcomplete.cmd batch file. I ran the diskpart command with the commands just as you have to expand the disks. It worked really well. But now the single disk resizeable option in fog works much better. Just a warning, you have to capture the image in that mode for it to work correctly on the target computer.

  • I don’t understand why you’re trying to resize partitions using a snapin, the image system can handle this for you already.