Closed
Conversation
Microsoft.SqlServer.Management.Smo.Server object may return null computername , we need resolve such situation
resolve issue dataplat#6632
using datalength to replace len, which will works on sql 2012,2014,2016
handle null computername
handle null computername
wsmelton
reviewed
Jul 1, 2020
| # key_id 102 eq service master key, thumbprint 3 means encrypted with machinekey | ||
| Write-Message -Level Verbose -Message "Querying service master key" | ||
| $sql = "SELECT substring(crypt_property,9,len(crypt_property)-8) as smk FROM sys.key_encryptions WHERE key_id=102 and (thumbprint=0x03 or thumbprint=0x0300000001)" | ||
| $sql = "SELECT substring(crypt_property,9,datalength(crypt_property)-8) as smk FROM sys.key_encryptions WHERE key_id=102 and (thumbprint=0x03 or thumbprint=0x0300000001)" |
Member
There was a problem hiding this comment.
What purpose does this change serve?
Member
There was a problem hiding this comment.
LEN returns the number of characters in the string, DATALENGTH returns the number of bytes.
Author
There was a problem hiding this comment.
i just see it here and did a test on my env and it works:
bugal/Powershell-Modules@606153b
there are other fix to workground for SQL cluster too ,you may need this NetSPI/Powershell-Modules#9
5 tasks
Member
|
I'm closing this PR as this change and the error provided are not reproducible by our test or manual testing I've done in my lab. Discussion can continue in your issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Purpose
[Microsoft.SqlServer.Management.Smo.Servermay return null computername ,so Resolve-NetBiosName、Resolve-SqlIpAddress will return null too, and cause other function fails.Approach
modify Resolve-NetBiosName and Resolve-SqlIpAddress to handle null computername .
Commands to test
Screenshots
Learning