Guest User

Untitled

a guest
Nov 20th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. $Computer = "abe.com"
  2. $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $computer)
  3.  
  4. $RegKey=$Reg.OpenSubKey("SYSTEM\CurrentControlSet\services\NTDS\Parameters"
  5. $NTDSPath = $Regkey.GetValue("DSA Database file")
  6. $NTDSREMOTEPath = "\$computer$NTDSPath" -replace ":","$"
  7. $NTDSREMOTEPath = Get-item $NTDSREMOTEPath | Select-Object -ExpandProperty Length
  8.  
  9. ($NTDSREMOTEPath /1GB).ToString("0.000"+" GB")
  10.  
  11. Exception calling "OpenSubKey" with "1" argument(s): "Requested registry access is not allowed."
  12. At C:UsersDocumentsHealthCheckhardwareMonitoring.ps1:40 char:1
  13. + $RegKey= $Reg.OpenSubKey("SYSTEM\CurrentControlSet\services\NTDS\Parameters" ...
  14. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
  16. + FullyQualifiedErrorId : SecurityException
  17.  
  18. You cannot call a method on a null-valued expression.
  19. At C:UsersDocumentsHealthCheckhardwareMonitoring.ps1:41 char:1
  20. + $NTDSPath = $Regkey.GetValue("DSA Database file")
  21. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. + CategoryInfo : InvalidOperation: (:) [], RuntimeException
  23. + FullyQualifiedErrorId : InvokeMethodOnNull
  24.  
  25. Get-item : Cannot find path '\abc.com' because it does not exist.
  26. At C:UsersDocumentsHealthCheckhardwareMonitoring.ps1:43 char:19
  27. + $NTDSREMOTEPath = Get-item $NTDSREMOTEPath | Select-Object -ExpandProperty Lengt ...
  28. + ~~~~~~~~~~~~~~~~~~~~~~~~
  29. + CategoryInfo : ObjectNotFound: (\abc.com:String) [Get-Item], ItemNotFoundE
  30. xception
  31. + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand
Add Comment
Please, Sign In to add comment