Sync-HashesFromHibp : One or more errors occurred.
dimforensics opened this issue · 4 comments
@dimforensics
Can you type $error[0].Exception.ToString()
immediately after you get that error so we can see the exact cause
PS C:> $error[0].Exception.ToString()
System.AggregateException: One or more errors occurred. ---> System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalReplace(String sourceFileName, String destinationFileName, String destinationBackupFileName, Boolean ignoreMetadataErrors)
at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.WriteStoreFile(String file, Boolean append, IEnumerable1 hashes) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.AddHashRangeToStore(HashSet
1 incomingHashes, String range, OperationProgress progress)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.<>c__DisplayClass14_0.b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_01.<ForWorker>b__1() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action
1 body, Action2 bodyWithState, Func
4 bodyWithLocal, Func1 localInit, Action
1 localFinally)
at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action1 body) at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.ProcessRanges(OperationProgress progress, Int32 threads, CancellationToken ct) at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.Execute(OperationProgress progress, Int32 threads, CancellationToken ct) at Lithnet.ActiveDirectory.PasswordProtection.PowerShell.SyncHashesFromHibp.<>c__DisplayClass9_0.<EndProcessing>b__0() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Lithnet.ActiveDirectory.PasswordProtection.PowerShell.SyncHashesFromHibp.EndProcessing() at System.Management.Automation.CommandProcessorBase.Complete() ---> (Inner Exception #0) System.IO.IOException: The process cannot access the file because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalReplace(String sourceFileName, String destinationFileName, String destinationBackupFileName, Boolean ignoreMetadataErrors) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.WriteStoreFile(String file, Boolean append, IEnumerable
1 hashes)
at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.AddHashRangeToStore(HashSet1 incomingHashes, String range, OperationProgress progress) at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.<DownloadRange>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.<>c__DisplayClass14_0.<ProcessRanges>b__0(Int32 i) at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0
1.b__1()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )<---
---> (Inner Exception #1) System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalReplace(String sourceFileName, String destinationFileName, String destinationBackupFileName, Boolean ignoreMetadataErrors)
at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.WriteStoreFile(String file, Boolean append, IEnumerable1 hashes) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.AddHashRangeToStore(HashSet
1 incomingHashes, String range, OperationProgress progress)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.<>c__DisplayClass14_0.b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.b__1()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )<---
---> (Inner Exception #2) System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalReplace(String sourceFileName, String destinationFileName, String destinationBackupFileName, Boolean ignoreMetadataErrors)
at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.WriteStoreFile(String file, Boolean append, IEnumerable1 hashes) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.AddHashRangeToStore(HashSet
1 incomingHashes, String range, OperationProgress progress)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.<>c__DisplayClass14_0.b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.b__1()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )<---
---> (Inner Exception #3) System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalReplace(String sourceFileName, String destinationFileName, String destinationBackupFileName, Boolean ignoreMetadataErrors)
at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.WriteStoreFile(String file, Boolean append, IEnumerable1 hashes) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.AddHashRangeToStore(HashSet
1 incomingHashes, String range, OperationProgress progress)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.<>c__DisplayClass14_0.b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.b__1()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )<---
---> (Inner Exception #4) System.IO.IOException: The process cannot access the file because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalReplace(String sourceFileName, String destinationFileName, String destinationBackupFileName, Boolean ignoreMetadataErrors)
at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.WriteStoreFile(String file, Boolean append, IEnumerable1 hashes) at Lithnet.ActiveDirectory.PasswordProtection.BinaryStoreInstance.AddHashRangeToStore(HashSet
1 incomingHashes, String range, OperationProgress progress)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Lithnet.ActiveDirectory.PasswordProtection.HibpDownloader.<>c__DisplayClass14_0.b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.b__1()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )<---
Thanks for sending this through. We can see that the sync is trying to write to the files but is unable to because something else has them open.
The process cannot access the file because it is being used by another process.
Are you using DFS-R replication? You may need to try pausing that when running a sync.
The other thing I can suggest is trying to exclude that path from antivirus scanning.
If neither of those work, you may need to use a tool like procmon to see what process is locking those files open.
Thank you very much @ryannewington for given options!
In my case, it is because of antivirus
after I disabled it -> it has synced successfully!