Automating Native Commands

You'll discover that some native commands require interactive keystrokes before they work. For example, to format a drive, for security reasons you need to enter the current volume name and then hit "Y." To automate these commands, you should put the input onto the pipeline in the order the command expects the information to be typed in, and then feed it to the command:

"Volume", "Y" | Format i: /FS:NTFS /Q

Twitter This Tip! ReTweet this Tip!


Posted May 14 2010, 08:00 AM by ps1

Comments

Twitter Trackbacks for Automating Native Commands - Power Tips - PowerShell.com [powershell.com] on Topsy.com wrote Twitter Trackbacks for Automating Native Commands - Power Tips - PowerShell.com [powershell.com] on Topsy.com
on 05-14-2010 8:59 AM

Pingback from  Twitter Trackbacks for                 Automating Native Commands - Power Tips - PowerShell.com         [powershell.com]        on Topsy.com

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.