0

[PS] C:\Users\Exchange_Admin\Desktop>.\dSHeuristics.ps1
dSHeuristics has already been set to 001
Checking Authenticated Users are part of “Pre-Windows 2000 Compatible Access” group
.. It has already been removed
Going through the Hosted Orgs
.OU:
You cannot call a method on a null-valued expression.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:72 char:5
+ $SubOUacl.RemoveAccessRule($SubOUace1) >$null 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:74 char:5
+ $SubOUacl.RemoveAccessRule($SubOUace2) >$null 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Exception calling “.ctor” with “4” argument(s): “Value cannot be null.
Parameter name: identity”
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:77 char:18
+ … SubOUace3 = New-Object System.DirectoryServices.ActiveDirectoryAccess …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:78 char:5
+ $SubOUacl.AddAccessRule($SubOUace3) >$null 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Exception calling “.ctor” with “4” argument(s): “Value cannot be null.
Parameter name: identity”
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:79 char:18
+ … SubOUace4 = New-Object System.DirectoryServices.ActiveDirectoryAccess …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:80 char:5
+ $SubOUacl.AddAccessRule($SubOUace4) >$null 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

Set-Acl : Cannot bind argument to parameter ‘AclObject’ because it is null.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:81 char:41
+ Set-Acl -Path $SubOUpath -AclObject $SubOUacl
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-Acl], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.SetAclCommand

Get-ADOrganizationalUnit : Cannot validate argument on parameter ‘SearchBase’. The argument is null. Provide a valid value for the argument, and then try
running the command again.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:84 char:53
+ … SubOUs2 = Get-ADOrganizationalUnit -SearchBase $SubOUDistName -Filter …
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-ADOrganizationalUnit], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.GetADOrganizationalUnit

Get-ADComputer : Cannot validate argument on parameter ‘SearchBase’. The argument is null. Provide a valid value for the argument, and then try running the
command again.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:100 char:50
+ … mputers = Get-ADComputer -SearchBase $SubOU.DistinguishedName -Filte …
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.GetADComputer

.OU:
You cannot call a method on a null-valued expression.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:72 char:5
+ $SubOUacl.RemoveAccessRule($SubOUace1) >$null 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:74 char:5
+ $SubOUacl.RemoveAccessRule($SubOUace2) >$null 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Exception calling “.ctor” with “4” argument(s): “Value cannot be null.
Parameter name: identity”
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:77 char:18
+ … SubOUace3 = New-Object System.DirectoryServices.ActiveDirectoryAccess …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:78 char:5
+ $SubOUacl.AddAccessRule($SubOUace3) >$null 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Exception calling “.ctor” with “4” argument(s): “Value cannot be null.
Parameter name: identity”
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:79 char:18
+ … SubOUace4 = New-Object System.DirectoryServices.ActiveDirectoryAccess …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:80 char:5
+ $SubOUacl.AddAccessRule($SubOUace4) >$null 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

Set-Acl : Cannot bind argument to parameter ‘AclObject’ because it is null.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:81 char:41
+ Set-Acl -Path $SubOUpath -AclObject $SubOUacl
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Set-Acl], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.SetAclCommand

Get-ADOrganizationalUnit : Cannot validate argument on parameter ‘SearchBase’. The argument is null. Provide a valid value for the argument, and then try
running the command again.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:84 char:53
+ … SubOUs2 = Get-ADOrganizationalUnit -SearchBase $SubOUDistName -Filter …
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-ADOrganizationalUnit], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.GetADOrganizationalUnit

Get-ADComputer : Cannot validate argument on parameter ‘SearchBase’. The argument is null. Provide a valid value for the argument, and then try running the
command again.
At C:\Users\Exchange_Admin\Desktop\dSHeuristics.ps1:100 char:50
+ … mputers = Get-ADComputer -SearchBase $SubOU.DistinguishedName -Filte …
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-ADComputer], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.GetADComputer

[PS] C:\Users\Exchange_Admin\Desktop>

Answered question