C:\Users\Stuart\Desktop\Amy-EVA3 [master ≡ +0 ~1 -0 !]> $JournalObjectNotePropertyList
Name
----
event
FuelLevel
FuelUsed
JumpDist
StarPos
StarSystem
SystemAllegiance
SystemEconomy
SystemEconomy_Localised
SystemGovernment
SystemGovernment_Localised
SystemSecurity
SystemSecurity_Localised
timestamp
C:\Users\Stuart\Desktop\Amy-EVA3 [master ≡ +0 ~1 -0 !]> $AmyEventNotePPropertyList
Name
----
event
event_id
timestamp
C:\Users\Stuart\Desktop\Amy-EVA3 [master ≡ +0 ~1 -0 !]> Compare-Object -ReferenceObject $JournalObjectNotePropertyList -DifferenceObject $AmyEventSQLColumns -PassThru -IncludeEqual
Name SideIndicator
---- -------------
event ==
FuelLevel <=
FuelUsed <=
JumpDist <=
StarPos <=
StarSystem <=
SystemAllegiance <=
SystemEconomy <=
SystemEconomy_Localised <=
SystemGovernment <=
SystemGovernment_Localised <=
SystemSecurity <=
SystemSecurity_Localised <=
timestamp <=
if ($SQLCredentials -eq $null)
{
$SQLCredentials = Get-Credential
}
$SQLPassword = $SQLCredentials.GetNetworkCredential().password
$Debug = 1
$SQLServer = 'sql.database.windows.net'
$SQLdbName = 'mydb'
$SQLEventTableName = 'event'
$SQLConnectionString = 'Data Source=' + $SQLServer + ';Initial Catalog=' + $SQLdbName + ';Integrated Security=False;User ID=' + $SQLCredentials.UserName + ';Password=' + $SQLPassword
$SQLConnection = New-Object System.Data.SqlClient.SqlConnection ($SQLConnectionString)
$SQLConnection.Open()
if ($SQLConnection.State -eq [System.Data.ConnectionState]::Open)
{
if ($Debug -eq 1)
{
Write-Host -ForegroundColor Green 'Database connection successful !!!'
}
}
$SQLCommandQuery = "SELECT COLUMN_NAME FROM " + $SQLdbName + ".INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" + $SQLEventTableName + "'"
if ($SQLCommandQuery)
{
$SQLCommand = New-Object system.Data.sqlclient.SqlCommand
$AmyEventSQLColumns = New-Object psobject
$SQLCommand.connection = $SQLConnection
$SQLCommand.commandtext = $SQLCommandQuery
$SQLResponse = $SQLCommand.ExecuteReader()
while ($SQLResponse.Read())
{
Add-Member -InputObject $AmyEventSQLColumns -MemberType NoteProperty -Name ($SQLResponse.GetValue($1)) -value "" > $null
}
}
$JSONContents = gc .\SmallJournal.json
$ErrorActionPreferenceBefore = $ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"
$JSONContents = $JSONContents.Replace(':true,', ':"1",')
$JSONContents = $JSONContents.Replace(':false,', ':"0",')
$ErrorActionPreference = $ErrorActionPreferenceBefore
$JournalObjectNotePropertyList = ($JSONContents | ConvertFrom-Json | gm -MemberType NoteProperty | Select-Object Name)
$AmyEventNotePPropertyList = $AmyEventSQLColumns | gm -MemberType NoteProperty | Select-Object Name
Compare-Object -ReferenceObject $JournalObjectNotePropertyList -DifferenceObject $AmyEventSQLColumns -PassThru -IncludeEqual
C:\Users\Stuart\Desktop\Amy-EVA3 [master ≡ +0 ~1 -0 !]> $AmyEventNotePPropertyList |gm
TypeName: Selected.Microsoft.PowerShell.Commands.MemberDefinition
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Name NoteProperty string Name=event
C:\Users\Stuart\Desktop\Amy-EVA3 [master ≡ +0 ~1 -0 !]> $JournalObjectNotePropertyList |gm
TypeName: Selected.Microsoft.PowerShell.Commands.MemberDefinition
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Name NoteProperty string Name=event
SideIndicator NoteProperty string SideIndicator===
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.