Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Import/Export SQL Server 2000 Enterprise Manager Registered Servers


Import/Export SQL Server 2000 Enterprise Manager Registered Servers

Author
Message
cmille19
cmille19
Old Hand
Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)

Group: General Forum Members
Points: 303 Visits: 724
Comments posted to this topic are about the item Import/Export SQL Server 2000 Enterprise Manager Registered Servers



MG-148046
MG-148046
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2264 Visits: 2718
I'm a newbie with PS. I get as far as sourcing the script but have no idea of what to do next.

MG

"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare

"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
cmille19
cmille19
Old Hand
Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)

Group: General Forum Members
Points: 303 Visits: 724
You once you've sourced the file

PS> . ./sqlem.ps1

You should be able to simply run the functions the Powershell script defines:

Export-RegisteredServers c:\servers.txt

or

Import-RegisteredServers c:\servers.txt



MG-148046
MG-148046
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2264 Visits: 2718
Doesn't work for me and I set execution to unrestricted. see attachment

MG

"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare

"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
Attachments
err.jpg (49 views, 27.00 KB)
cmille19
cmille19
Old Hand
Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)

Group: General Forum Members
Points: 303 Visits: 724
Please post the contents of your sqlem.ps1 file



MG-148046
MG-148046
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2264 Visits: 2718
It seems that the article had some unprintable characters that PS didn't like. I put the code into an editor I have that shows control codes and found them. Removed them and it all works like a charm! Smile Thanks

MG

"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."
Tony Hoare

"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
cmille19
cmille19
Old Hand
Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)

Group: General Forum Members
Points: 303 Visits: 724
I noticed the same thing, I'll follow up with the site owners, as it appears be a problem with their script editor. I'm able to reproduce an issue where multiple "?" characters appear when copying the code. It doesn't seem to matter whether I manually create the code with their editor or copy it from notepad. Perhaps it doesn't like some of the special characters (#, %, ?) used in Powershell.



AndrewL65
AndrewL65
Grasshopper
Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)Grasshopper (14 reputation)

Group: General Forum Members
Points: 14 Visits: 296
Does anyone know if its possible to do this without ps as I'm not allowed to run any ps scripts in my environment.
cmille19
cmille19
Old Hand
Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)Old Hand (303 reputation)

Group: General Forum Members
Points: 303 Visits: 724
It could be done in VBScript or Perl. Here's an old Perl script. I can't find old VBScript:


#Perl Script based on
#http://www.sqlservercentral.com/scripts/contributions/1467.asp

use strict;
use Getopt::Std;
use Win32::OLE;
use Win32::OLE::Const("Microsoft SQLDMO");

my (%args, $args, $serverfile, $groupname, $servername, $ServerGroup, $cnt);
my $err = 0;
my $SQLServer = new Win32::OLE 'SQLDMO.SQLServer';
my $Application = $SQLServer->{Application};


getopts('f:', \%args);
$serverfile = $args{f};
$cnt = 0;
open SERVERFILE, $serverfile or die "Cannot open file: $serverfile";
while (<SERVERFILE>Wink
{
print "Processing $_";
s/#.*//; # remove comments, ignore blank lines
if (!$_) {next;}
tr/\t / /s;
$cnt++;
($groupname, $servername) = split;
$ServerGroup = new Win32::OLE 'SQLDMO.ServerGroup';
$ServerGroup = CreateGroup($groupname);
RegisterServer($ServerGroup, $servername);
$ServerGroup = undef;
$servername = undef;
}
close SERVERFILE;
exit $err;


sub CreateGroup
{
my $ServerGroup = new Win32::OLE 'SQLDMO.ServerGroup';
$ServerGroup->{Name} = $groupname;
$Application->ServerGroups->Add($ServerGroup);
$ServerGroup = undef;
$ServerGroup = $Application->ServerGroups->Item($groupname);
return $ServerGroup;
}

sub RegisterServer
{
my $RegisteredServer = new Win32::OLE 'SQLDMO.RegisteredServer';
$RegisteredServer->{Name} = $servername;
$RegisteredServer->{UseTrustedConnection} = 1;
$RegisteredServer->{PersistFlags} = 1;
$ServerGroup->RegisteredServers->Add($RegisteredServer);
$RegisteredServer = undef;
}





Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search