Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Cant work out why this bit of PS isnt working

$
0
0
hello,I am following an online tutorial to help me learn powershell. It's pretty good but I have a piece of code from it, and although typed exactly correct, is not working and I cant figure out why, would love to know...$instance = $args[0][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null$ServerInstance = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $instanceWrite-Host "Name: " $ServerInstance.NameWrite-Host "Edition: " $ServerInstance.EditionWrite-Host "Version: " $ServerInstance.VersionWrite-Host "ProductLevel: " $ServerInstance.ProductLevel...It returns the name, but nothing else.Thank you.Regards,D.PS: Does anybody know of a good resource that will teach me to create SQL connection strings to SQL from a powershell console that can be used in a script, please? Thank you.

Viewing all articles
Browse latest Browse all 467

Trending Articles