powershell - Read Computer Names from Text File and Execute a Command -


i have simple powershell script check status of bitlocker drive encryption on computer on network. i'd script determine status of multiple computers in text file.

here's basic script far:

$getid = read-host "what device id?" $computerid = manage-bde -status -cn "$getid" foreach ($computer in $computerid) {     write-host("$computer") } 

what prompt tech host name , gives results. how can have script prompt tech path text file , have script give list of results text file?

$textfilepath = read-host "what path text file?" if (test-path $textfilepath){     $computersarray = get-content $textfilepath     foreach ($computer in $computersarray) {         if (test-connection $computer -count 1){             $computerstatus = manage-bde -status -cn "$computer"             write-host($computerstatus)         } else {             write-host("$computer appears offline.")         }     } } else {     write-error "the text file not found, check path." } 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -