Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Import/Export SQL Server 2000 Enterprise Manager Registered Servers Expand / Collapse
Author
Message
Posted Tuesday, February 19, 2008 2:30 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 8:01 AM
Points: 258, Visits: 701
Comments posted to this topic are about the item Import/Export SQL Server 2000 Enterprise Manager Registered Servers


Post #457263
Posted Thursday, April 24, 2008 11:05 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 9:19 AM
Points: 1,804, Visits: 2,179
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.

Post #490129
Posted Thursday, April 24, 2008 12:40 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 8:01 AM
Points: 258, Visits: 701
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



Post #490217
Posted Thursday, April 24, 2008 12:51 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 9:19 AM
Points: 1,804, Visits: 2,179
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.



  Post Attachments 
err.jpg (38 views, 27.92 KB)
Post #490230
Posted Thursday, April 24, 2008 8:07 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 8:01 AM
Points: 258, Visits: 701
Please post the contents of your sqlem.ps1 file


Post #490391
Posted Friday, April 25, 2008 5:55 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 9:19 AM
Points: 1,804, Visits: 2,179
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! :) 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.

Post #490551
Posted Friday, April 25, 2008 6:48 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 8:01 AM
Points: 258, Visits: 701
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.


Post #490599
Posted Wednesday, September 28, 2011 5:56 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, August 14, 2014 6:58 AM
Points: 2, Visits: 100
Does anyone know if its possible to do this without ps as I'm not allowed to run any ps scripts in my environment.
Post #1182373
Posted Wednesday, September 28, 2011 9:47 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 8:01 AM
Points: 258, Visits: 701
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>)
{
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;
}




Post #1182593
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse