Skip to content

Commit f43d6eb

Browse files
author
Ajay Dwivedi
committed
Adding New Project for Sql-Lab
Adding New Project for Sql-Lab
1 parent bb8708c commit f43d6eb

11 files changed

+170
-7
lines changed
1 KB
Binary file not shown.

Misscellaneous Queries/Misscellaneous Queries.ssmssqlproj

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
1616
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
1717
</ConnectionNode>
18+
<ConnectionNode Name="LOCALHOST:CORPORATE\adwivedi">
19+
<Created>2020-04-14T09:17:10.2941827+05:30</Created>
20+
<Type>SQL</Type>
21+
<Server>LOCALHOST</Server>
22+
<UserName />
23+
<Authentication>Windows Authentication</Authentication>
24+
<InitialDB>master</InitialDB>
25+
<LoginTimeout>30</LoginTimeout>
26+
<ExecutionTimeout>0</ExecutionTimeout>
27+
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
28+
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
29+
</ConnectionNode>
1830
</Items>
1931
</LogicalFolder>
2032
<LogicalFolder Name="Queries" Type="0" Sorted="true">
@@ -170,8 +182,8 @@
170182
<FullPath>Return Query Output as HTML Table.sql</FullPath>
171183
</FileNode>
172184
<FileNode Name="RoboCopy.sql">
173-
<AssociatedConnectionMoniker />
174-
<AssociatedConnSrvName />
185+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
186+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
175187
<AssociatedConnUserName />
176188
<FullPath>RoboCopy.sql</FullPath>
177189
</FileNode>

Misscellaneous Queries/RoboCopy.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ robocopy \\SRCServer\F$\dump\db01\ v:\dump\DB02_dump\ *-data.DMP /XF "AMGMusicAu
2424
-- Copy all files of extension *.csql from source folder to destination
2525
robocopy \\SourceServer\F$\dump\ I:\Backups\CW\Logs\ *.csq /is
2626

27-
robocopy SourcePath DestinationPath FileFullName /it /zb
27+
robocopy SourcePath DestinationPath FileFullName /it /zb
28+
29+
-- Copy all files/folders including Empty directories
30+
Robocopy /S /E \\SourceDbServer\F:\AllProd F:\AllProd /MT

PowerShell Commands/Enable-Powershell-for-Local-LAN-System.sql

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
https://stackoverflow.com/questions/14952833/get-wmiobject-win32-process-computername-gets-error-access-denied-code-0x8
22
-- https://stackoverflow.com/a/14953535/4449743
33
-- https://stackoverflow.com/a/11338395/4449743
4+
-- https://stackoverflow.com/questions/21548566/how-to-add-more-than-one-machine-to-the-trusted-hosts-list-using-winrm
45
Launch "wmimgmt.msc"
56
Right-click on "WMI Control (Local)" then select Properties
67
Go to the "Security" tab and select "Security" then "Advanced" then "Add"
@@ -21,4 +22,32 @@ Get-Credential -UserName "$computerName\Ajay" -Message "Password please" | New-S
2122
$creds = Get-StoredCredential -Target $computerName;
2223

2324
Get-VolumeInfo -ComputerName $computerName
24-
Get-DbaDiskSpace -ComputerName $computerName -Credential $creds
25+
Get-DbaDiskSpace -ComputerName $computerName -Credential $creds
26+
27+
-- =======================================================================================
28+
Enter-PSSession : Connecting to remote server msi failed with the following error message : WinRM
29+
cannot process the request. The following error with errorcode 0x80090311 occurred while using
30+
Kerberos authentication: We can't sign you in with this credential because your domain isn't
31+
available. Make sure your device is connected to your organization's network and try again. If you
32+
previously signed in on this device with another credential, you can sign in with that credential.
33+
Possible causes are:
34+
-The user name or password specified are invalid.
35+
-Kerberos is used when no authentication method and no user name are specified.
36+
-Kerberos accepts domain user names, but not local user names.
37+
-The Service Principal Name (SPN) for the remote computer name and port does not exist.
38+
-The client and remote computers are in different domains and there is no trust between the two
39+
domains.
40+
After checking for the above issues, try the following:
41+
-Check the Event Viewer for events related to authentication.
42+
-Change the authentication method; add the destination computer to the WinRM TrustedHosts
43+
configuration setting or use HTTPS transport.
44+
Note that computers in the TrustedHosts list might not be authenticated.
45+
-For more information about WinRM configuration, run the following command: winrm help config.
46+
For more information, see the about_Remote_Troubleshooting Help topic.
47+
At line:1 char:1
48+
+ Enter-PSSession -ComputerName msi -Credential (Get-StoredCredentials ...
49+
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
+ CategoryInfo : InvalidArgument: (msi:String) [Enter-PSSession], PSRemotingTransportEx
51+
ception
52+
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
53+

PowerShell Commands/PowerShell Commands.ssmssqlproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
<FullPath>Common-Commands.sql</FullPath>
5757
</FileNode>
5858
<FileNode Name="Different-Files-Between-Paths.sql">
59-
<AssociatedConnectionMoniker />
60-
<AssociatedConnSrvName />
59+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
60+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
6161
<AssociatedConnUserName />
6262
<FullPath>Different-Files-Between-Paths.sql</FullPath>
6363
</FileNode>

SQL-Lab/AG-FCI-POC.pptx

554 KB
Binary file not shown.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
$file = 'C:\Windows\System32\drivers\etc\hosts'
2+
3+
$file_content = Get-Content $file
4+
5+
foreach($line in $file_content) {
6+
if(-not [string]::IsNullOrEmpty($line.Trim())) {
7+
if($line -match "^(?<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+(?<hostname>[a-zA-Z_0-9-]*)$") {
8+
$ip = $Matches['ip']
9+
$hostName = $Matches['hostname']
10+
11+
#Write-Host "$hostName => $ip"
12+
$command = @"
13+
14+
Add-DnsServerResourceRecordA -Name "$hostName" -ZoneName "Contso.com" -AllowUpdateAny -IPv4Address "$ip"
15+
"@;
16+
if (-not ($hostName -in @('host','dc'))) {
17+
$command
18+
}
19+
}
20+
}
21+
}
22+
23+
/*
24+
help Add-DnsServerResourceRecordA
25+
Get-DnsServerResourceRecord -ZoneName "contso.com"
26+
Add-DnsServerResourceRecordA -Name "Win10" -ZoneName "Contso.com" -AllowUpdateAny -IPv4Address "192.168.0.105"
27+
*/

SQL-Lab/SQL-Lab.ssmssqlproj

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0"?>
2+
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="SQL-Lab">
3+
<Items>
4+
<LogicalFolder Name="Connections" Type="2" Sorted="true">
5+
<Items>
6+
<ConnectionNode Name="(local):CORPORATE\adwivedi">
7+
<Created>2020-04-16T19:07:55.7236621+05:30</Created>
8+
<Type>SQL</Type>
9+
<Server>(local)</Server>
10+
<UserName />
11+
<Authentication>Windows Authentication</Authentication>
12+
<InitialDB />
13+
<LoginTimeout>30</LoginTimeout>
14+
<ExecutionTimeout>0</ExecutionTimeout>
15+
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
16+
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
17+
</ConnectionNode>
18+
</Items>
19+
</LogicalFolder>
20+
<LogicalFolder Name="Queries" Type="0" Sorted="true">
21+
<Items>
22+
<FileNode Name="hosts-file-content.sql">
23+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
24+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
25+
<AssociatedConnUserName />
26+
<FullPath>hosts-file-content.sql</FullPath>
27+
</FileNode>
28+
<FileNode Name="Powershell-hosts-content-2-IP-HOSTNAME-Splitting.sql">
29+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
30+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
31+
<AssociatedConnUserName />
32+
<FullPath>Powershell-hosts-content-2-IP-HOSTNAME-Splitting.sql</FullPath>
33+
</FileNode>
34+
</Items>
35+
</LogicalFolder>
36+
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true">
37+
<Items>
38+
<FileNode Name="AG-FCI-POC.pptx">
39+
<AssociatedConnectionMoniker />
40+
<AssociatedConnSrvName />
41+
<AssociatedConnUserName />
42+
<FullPath>AG-FCI-POC.pptx</FullPath>
43+
</FileNode>
44+
<FileNode Name="Simulating a Multi Subnet cluster for setting up SQL Server Always On Availability Groups - lab setup.pdf">
45+
<AssociatedConnectionMoniker />
46+
<AssociatedConnSrvName />
47+
<AssociatedConnUserName />
48+
<FullPath>Simulating a Multi Subnet cluster for setting up SQL Server Always On Availability Groups - lab setup.pdf</FullPath>
49+
</FileNode>
50+
</Items>
51+
</LogicalFolder>
52+
</Items>
53+
</SqlWorkbenchSqlProject>

SQL-Lab/hosts-file-content.sql

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
192.168.178.100 host
2+
192.168.178.102 workstation
3+
192.168.178.103 servera
4+
192.168.178.104 serverb
5+
192.168.178.110 serverc
6+
192.168.178.106 ubuntu
7+
192.168.178.111 fedora
8+
192.168.178.112 mate
9+
10+
192.168.0.100 vmhost
11+
192.168.0.101 msi
12+
192.168.0.102 workstation
13+
192.168.0.103 servera
14+
192.168.0.104 serverb
15+
192.168.0.105 win10
16+
192.168.0.106 ubuntu
17+
192.168.0.107 workstation.msi
18+
192.168.0.108 servera.msi
19+
192.168.0.109 serverb.msi
20+
192.168.0.110 serverc
21+
192.168.0.111 fedora
22+
192.168.0.112 mate
23+
24+
192.168.0.116 dc
25+
192.168.0.117 sqla
26+
192.168.0.118 sqlb
27+
192.168.0.119 sqlc
28+
192.168.0.120 sqld
29+
192.168.0.121 sqle
30+
31+
192.168.178.116 dc
32+
192.168.178.117 sqla
33+
192.168.178.118 sqlb
34+
192.168.178.119 sqlc
35+
192.168.178.120 sqld
36+
192.168.178.121 sqle

SQLDBA-SSMS Solution.ssmssln

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "Self-Service-Module-Signed-
6161
EndProject
6262
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "Linux", "Linux\Linux.ssmssqlproj", "{4C79BFF5-461D-4BF1-A467-30CC92F3170F}"
6363
EndProject
64+
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "SQL-Lab", "SQL-Lab\SQL-Lab.ssmssqlproj", "{F88BA745-0139-4320-94DA-2EE60B0A1D68}"
65+
EndProject
6466
Global
6567
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6668
Default|Default = Default|Default
@@ -95,7 +97,8 @@ Global
9597
{FC215972-4485-4B29-82C1-4DDD218D9303}.Default|Default.ActiveCfg = Default
9698
{9B9DD5DB-FCD6-4B9F-9BC0-54DCAF827C99}.Default|Default.ActiveCfg = Default
9799
{4C79BFF5-461D-4BF1-A467-30CC92F3170F}.Default|Default.ActiveCfg = Default
98-
{91D26CF7-4CD2-4EFF-A4EA-8BFA0B460B57}.Default|Default.ActiveCfg = Default
100+
{A2A2EEFA-E39E-403A-B77A-7449BF14CE65}.Default|Default.ActiveCfg = Default
101+
{F88BA745-0139-4320-94DA-2EE60B0A1D68}.Default|Default.ActiveCfg = Default
99102
EndGlobalSection
100103
GlobalSection(SolutionProperties) = preSolution
101104
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)