PowerShell script problem RRS feed

  • Question

  • I have a simple PowerShell script that I'm using when I import drivers to MDT. It works, but for some reason it will get stuck forever to this step where it creates a selection profile. It won't return any error and it's still creating the selection profil, but it won't continue any further from that step.

    Import-Module "C:\Program Files\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1" New-PSDrive -Name "DS002" -PSProvider MDTProvider -Root "D:\MDT\Production" $Manufacturer = Read-Host 'Manufacturer is?' $ModelName = Read-Host 'Model is?' new-item -path "DS002:\Out-of-Box Drivers\Windows 7\x64\$Manufacturer" -enable "True" -Name $ModelName -Comments "" -ItemType "folder" -Verbose

    #Import the drivers import-mdtdriver -path "DS002:\Out-of-Box Drivers\Windows 7\x64\$Manufacturer\$ModelName" -SourcePath "D:\DriverSource\HP\Windows 7 x64\HP_Z_Elite_Pro_G1" -Verbose #Create selection profile new-item -path "DS002:\Selection Profiles" -enable "True" -Name "$Manufacturer $ModelName - Windows 7 x64" -Comments "" -Definition "<SelectionProfile><Include path=`"Out-of-Box Drivers\Windows 7\x64\$Manufacturer\$ModelName`" /></SelectionProfile>" -ReadOnly "False" -Verbose $HOST.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | OUT-NULL $HOST.UI.RawUI.Flushinputbuffer()

    • Edited by DamonWH Sunday, October 26, 2014 8:50 AM
    Sunday, October 26, 2014 8:48 AM


  • Never mind. This one caused the problem:

    $HOST.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | OUT-NULL $HOST.UI.RawUI.Flushinputbuffer()

    It was there because I just wanted to pause the script when it's ready.

    • Marked as answer by DamonWH Sunday, October 26, 2014 10:26 AM
    Sunday, October 26, 2014 10:26 AM

All replies