Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/fix null reference exceptions #135

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alansingfield
Copy link

This is what I needed to do to get the script to run reliably on Server 2019, Powershell 7.3.1

In Debug-KerberosTicketEncryption - if $kerberosTicketEncryptionClient is an array with 1 element, the condition then goes on to try to read the .Value property, which is $null. Then .ToString() on this gives a null reference. I added a check to cope with this.

The check for EncryptionCiphers
(Get-SmbServerConfiguration).PSobject.Properties.Name -contains "EncryptionCiphers"
was missing an outer set of brackets which stopped it from detecting that this property was missing on down-level servers.

There were a number of calls to the .Value property of the SID - this is a string already so we get $null rather than the desired value - causing null reference exceptions.

The Set-ADAccountPassword cmdlet takes a string DN in the -Identity property, not an object.

If $kerberosTicketEncryptionClient is an array with one element or more, it then tries to read null.
The down-level check for "Your operating system does not support the property 'EncryptionCiphers'" was not working correctly
The $azureStorageIdentity.SID / DomainSID properties should be used directly, rather than using the .Value
The Set-ADAccountPassword cmdlet should be called with a DistinguishedName string not the raw result of Get-AzStorageAccountADObject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant