Configure encryption level for all TS sessions (Perl)
This code can be found in
Chapter 17 of Windows Server 2003 Security Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the Perl code from this site.
# This code sets the encryption level for all TS sessions
# ------ SCRIPT CONFIGURATION ------
use Win32::OLE qw(in);
use constant LOW_LEVEL => 1;
use constant CLIENT_COMPAT => 2;
use constant HIGH_ENCRYPTION => 3;
use constant FIPS_COMPLIANT => 4;
$strComputer = '.';
$intLevel = HIGH_ENCRYPTION;
# ------ END CONFIGURATION ---------
$objWMI = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2');
$colItems = $objWMI->ExecQuery('Select * from Win32_TSGeneralSetting');
foreach my $objItem (in $colItems) {
$intRC = $objItem->SetEncryptionLevel($intLevel);
if ($intRC) {
print 'Error setting encryption level for ' . $objItem->TerminalName . ':' . $intRC, "\n";
}
else {
print 'Set encryption level for ' . $objItem->TerminalName . ' to ' . $intLevel, "\n";
}
}
|
This code has been viewed 576 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|