![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Pipe Yes or No to cmdlet I am trying to schedule via windows scheduler the execution of the following script: -------------------Begin SCRIPT------------------- param ([string] $DPMServerName, [string] $LibraryName) if (!(Get-PSSnapin microsoft.dataprotectionmanager.powershell)) {write-host "Adding PS Snapin for DPM..." -Fore Green add-PSSnapin Microsoft.DataProtectionManager.PowerShell} if(("-?","-help") -contains $args[0]) { Write-Host "Usage: UnlockLibrary.ps1 [[-DPMServerName] <Name of the DPM server>] [-LibraryName] <Name of the library>" Write-Host "Example: UnlockLibrary.ps1 -DPMServerName MyDPMServer.domain.local -LibraryName "My library"" exit 0 } if (!$DPMServerName) { $DPMServerName = Read-Host "DPM server name: " if (!$DPMServerName) { Write-Error "Dpm server name not specified." exit 1 } } if (!$LibraryName) { $LibraryName = Read-Host "Library name: " if (!$LibraryName) { Write-Error "Library name not specified." exit 1 } } if (!(Connect-DPMServer $DPMServerName)) { Write-Error "Failed to connect To DPM server $DPMServerName" exit 1 } $library = Get-DPMLibrary $DPMServerName | where {$_.UserFriendlyName -eq $LibraryName} if (!$library) { Write-Error "Failed to find library with user friendly name $LibraryName" exit 1 } Unlock-DPMLibraryDoor -DPMLibrary $library -------------------END SCRIPT------------------- The problem is Unlock-DPMLibraryDoor prompts for a Yes or No to continue and MS DPM Team has not provided a parameter to specify this. How can I effectively echo the response to the console like you would in a dos cmd (echo Y | Unlock-DPM....) Any help would be greatly appreaciated. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Pipe Yes or No to cmdlet Patrick Fitchie wrote: Quote: > Unlock-DPMLibraryDoor -DPMLibrary $library Quote: > The problem is Unlock-DPMLibraryDoor prompts for a Yes or No to continue and > MS DPM Team has not provided a parameter to specify this. done their homework. I don't have the snapin to try it out myself. Unlock-DPMLibraryDoor -DPMLibrary $library -Confirm:$false Let us know how it goes. If this does not work, we really need to push back to that team so that they implement this common powershell convention. -- $signature = "Hal Rottenberg, MVP - Admin Frameworks" $projects = @{ title = "Blog Author"; url = "http://halr9000.com" }, @{ title = "Co-host"; url = "http://powerscripting.net" }, @{ title = "Community Director"; url = "http://PowerShellCommunity.org" }, @{ title = "Psi Webmaster"; url = "http://psi-im.org" } |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Pipe Yes or No to cmdlet Hi Hal, Thanks for your response. Unfortunately the DPM team has not included the common convention and does not work. Patrick "Hal Rottenberg [MVP]" wrote: Quote: > Patrick Fitchie wrote: Quote: > > Unlock-DPMLibraryDoor -DPMLibrary $library Quote: > > The problem is Unlock-DPMLibraryDoor prompts for a Yes or No to continue and > > MS DPM Team has not provided a parameter to specify this. > Patrick, try this. It may not work--but it really should if the DPM team has > done their homework. I don't have the snapin to try it out myself. > > Unlock-DPMLibraryDoor -DPMLibrary $library -Confirm:$false > > Let us know how it goes. If this does not work, we really need to push back to > that team so that they implement this common powershell convention. > > > -- > $signature = "Hal Rottenberg, MVP - Admin Frameworks" > $projects = @{ title = "Blog Author"; url = "http://halr9000.com" }, > @{ title = "Co-host"; url = "http://powerscripting.net" }, > @{ title = "Community Director"; url = "http://PowerShellCommunity.org" }, > @{ title = "Psi Webmaster"; url = "http://psi-im.org" } > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Pipe Yes or No to cmdlet Patrick Fitchie wrote: Quote: > Hi Hal, > > Thanks for your response. Unfortunately the DPM team has not included the > common convention and does not work. Perhaps Marco's link will help in the meantime. -- $signature = "Hal Rottenberg, MVP - Admin Frameworks" $projects = @{ title = "Blog Author"; url = "http://halr9000.com" }, @{ title = "Co-host"; url = "http://powerscripting.net" }, @{ title = "Community Director"; url = "http://PowerShellCommunity.org" }, @{ title = "Psi Webmaster"; url = "http://psi-im.org" } |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Quest AD cmdlet -what is the cmdlet to remove computer object | PowerShell | |||
| Pipe a pipe command to a file | VB Script | |||
| Invoking Cmdlet Get-Location from cmdlet,cant get Currnt Directory | PowerShell | |||
| Whether a cmdlet derives from cmdlet or pscmdlet | PowerShell | |||
| Custom cmdlet suite best practices: pipe .NET objects? ...or XmlDocuments? | PowerShell | |||