PowerShellEmpire / PowerTools

PowerTools is a collection of PowerShell projects with a focus on offensive operations.
Other
2.06k stars 813 forks source link

Invoke-EnumerateLocalAdmins failed with problem writing to file #20

Closed digininja closed 9 years ago

digininja commented 9 years ago

I tried to back up the file Invoke-EnumerateLocalAdmins was saving its data to and must have done it just as it tried to write so it failed with the following error:

VERBOSE: [*] Enumerating server abc.com (12551 of 16544)
Out-File : The process cannot access the file 'admins.csv' because it is being used by another process.
At line:1 char:117
+ ConvertTo-Csv -NoTypeInformation  | Foreach-Object {$start=$true}{if ($start)
 {$start=$false} else {$_}}  | Out-File <<<<  -FilePath 'admins.csv' -Encoding
'ASCII' -Append
    + CategoryInfo          : OpenError: (:) [Out-File], IOException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.Ou
   tFileCommand

It would be good if it had a way to try to recover from this, especially as I was at 12551 of 16544 servers scanned.

Is there a way to tell it to start again on the server it was trying when it failed? I have a list of all the servers and I have a list of all that it already scanned.

ChrisTruncer commented 9 years ago

I believe you should be able to do that with the built in switches right now. You should be able to use the parameter "-HostList" and a filename. It will then connect to only the systems in that file. So in this case, you should be able to give it the file containing just the systems you haven't enumerated yet.

digininja commented 9 years ago

I'll check that out, thanks On 9 May 2015 01:21, "ChrisTruncer" notifications@github.com wrote:

I believe you should be able to do that with the built in switches right now. You should be able to use the parameter "-HostList" and a filename. It will then connect to only the systems in that file. So in this case, you should be able to give it the file containing just the systems you haven't enumerated yet.

— Reply to this email directly or view it on GitHub https://github.com/Veil-Framework/PowerTools/issues/20#issuecomment-100397822 .