I’m trying to find database size of DC which is located in NTDS service. My script is:
$ Computer = "abe.com" $ Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ computer) $ RegKey=$ Reg.OpenSubKey("SYSTEM\CurrentControlSet\services\NTDS\Parameters" $ NTDSPath = $ Regkey.GetValue("DSA Database file") $ NTDSREMOTEPath = "\$ computer$ NTDSPath" -replace ":","$ " $ NTDSREMOTEPath = Get-item $ NTDSREMOTEPath | Select-Object -ExpandProperty Length ($ NTDSREMOTEPath /1GB).ToString("0.000"+" GB")
After running this I got an error:
Exception calling "OpenSubKey" with "1" argument(s): "Requested registry access is not allowed." At C:\Users\Documents\HealthCheck\hardwareMonitoring.ps1:40 char:1 + $ RegKey= $ Reg.OpenSubKey("SYSTEM\CurrentControlSet\services\NTDS\Parameters" ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) , MethodInvocationException + FullyQualifiedErrorId : SecurityException You cannot call a method on a null-valued expression. At C:\Users\Documents\HealthCheck\hardwareMonitoring.ps1:41 char:1 + $ NTDSPath = $ Regkey.GetValue("DSA Database file") + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) , RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Get-item : Cannot find path '\abc.com\' because it does not exist. At C:\Users\Documents\HealthCheck\hardwareMonitoring.ps1:43 char:19 + $ NTDSREMOTEPath = Get-item $ NTDSREMOTEPath | Select-Object -ExpandProperty Lengt ... + ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (\abc.com\:String) [Get-Item], ItemNotFoundE xception + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand
I realized that my account does not have enough permission to query this path from regedit
I decided to login into “abc.com” and added my account with
full control and
read rights. What I have done was, right click on
permissions and add my account in.
I came back to run the script again. I got the same error!
It works with Admin account by the way. I want to execute the query without using a domain admin account.
What’s the reason in this case? Thank you so much!
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!