Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Editting the registry?
I want to restore the default admin shares on a user's machine.

I have to delete the following key from the registry.

To restore the default hidden administrative shares, delete the
AutoShareWks=20
DWORD value in the following registry key, and then restart your
computer:
 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\LanmanServer\Parame
ters

Can someone point me in the right direction? Possibly a tutorial for
doing=20
this in perl.=20

Thanks in Advance.

Mostro=20


Arthur DiSegna
Information Technology Group
Security Identification Systems Corporation
=20

-----Original Message-----
From: Brian Gunlogson [mailto:bmg300@yahoo.com]=20
Sent: Tuesday, October 26, 2004 12:28 PM
To: Kevin Old; beginners@perl.org
Subject: Re: Printing to a file

Put the MY in braces.

SO
print MY $line;

WOULD BECOME
print {MY} $line;

--- Kevin Old <kevinold@gmail.com> wrote:

> Hello everyone,
>=20
> First, this is a basic problem, but I have looked at it for over an
> hour and wasted time.  Now, I'm asking for help.
>=20
> For some reason nothing is being printed to the MY filehandle. Can
> someone see what I'm doing wrong?
>                                 print MY $line;



=09
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail=20

--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Report this thread to moderator Post Follow-up to this message
Old Post
adisegna@siscocorp.com
10-26-04 08:56 PM


Re: Editting the registry?
Subject:        	Editting the registry?
Date sent:      	Tue, 26 Oct 2004 12:25:33 -0400
From:           	<adisegna@siscocorp.com>
To:             	<beginners@perl.org>

> I want to restore the default admin shares on a user's machine.
>
> I have to delete the following key from the registry.
>
> To restore the default hidden administrative shares, delete the
> AutoShareWks
> DWORD value in the following registry key, and then restart your
> computer:
>  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\LanmanServer\Para
> me ters
>
> Can someone point me in the right direction? Possibly a tutorial for
> doing this in perl.

Install the Win32::Registry2 patch from
http://Jenda.Krynicky.cz/#Win32::Registry2 and read the docs.
(The patch will become the next version of the module if a new
version of libwin32 ever gets released.)

Another option is Win32::TieRegistry.

You can restart the computer by
use Win32;
Win32::InitiateSystemShutdown( undef, "The machine goes down
dudes.", 10, 0, 1);

See
perldoc Win32

HTH, Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


Report this thread to moderator Post Follow-up to this message
Old Post
Jenda Krynicky
10-27-04 01:55 AM


RE: Editting the registry?
I will get started on it. Thanks for the information Jenda.=20

Arthur DiSegna
Information Technology Group
Security Identification Systems Corporation
=20

-----Original Message-----
From: Jenda Krynicky [mailto:Jenda@Krynicky.cz]=20
Sent: Tuesday, October 26, 2004 4:56 PM
To: beginners@perl.org
Subject: Re: Editting the registry?

Subject:        	Editting the registry?
Date sent:      	Tue, 26 Oct 2004 12:25:33 -0400
From:           	<adisegna@siscocorp.com>
To:             	<beginners@perl.org>

> I want to restore the default admin shares on a user's machine.
>=20
> I have to delete the following key from the registry.
>=20
> To restore the default hidden administrative shares, delete the
> AutoShareWks=20
> DWORD value in the following registry key, and then restart your
> computer:
>  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\LanmanServer\Para
> me ters
>=20
> Can someone point me in the right direction? Possibly a tutorial for
> doing this in perl.=20

Install the Win32::Registry2 patch from=20
http://Jenda.Krynicky.cz/#Win32::Registry2 and read the docs.
(The patch will become the next version of the module if a new=20
version of libwin32 ever gets released.)

Another option is Win32::TieRegistry.

You can restart the computer by
use Win32;
Win32::InitiateSystemShutdown( undef, "The machine goes down=20
dudes.", 10, 0, 1);

See
perldoc Win32

HTH, Jenda
=3D=3D=3D=3D=3D Jenda@Krynicky.cz =3D=3D=3D http://Jenda.Krynicky.cz =
=3D=3D=3D=3D=3D
When it comes to wine, women and song, wizards are allowed=20
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Report this thread to moderator Post Follow-up to this message
Old Post
adisegna@siscocorp.com
10-28-04 01:55 AM


RE: Editting the registry?
Hey Jenda,

I am still trying to figure out the syntax/structure, etc of Perl but I
figured it out. Here is my simple script..=20

#!path\to\perl\
use Win32::Registry
$HKEY_LOCAL_MACHINE->DeleteValue($AutoShareWks);
=20
 Win32::Registry::DeleteValue('HKEY_LOCAL
_MACHINE\SYSTEM\CurrentControlSe
t\Services\lanmanserver\parameters', $AutoShareWks);

If someone has something different (easier or harder) let me know....=20

Thanks

Arthur=20

-----Original Message-----
From: Jenda Krynicky [mailto:Jenda@Krynicky.cz]=20
Sent: Tuesday, October 26, 2004 4:56 PM
To: beginners@perl.org
Subject: Re: Editting the registry?

Subject:        	Editting the registry?
Date sent:      	Tue, 26 Oct 2004 12:25:33 -0400
From:           	<adisegna@siscocorp.com>
To:             	<beginners@perl.org>

> I want to restore the default admin shares on a user's machine.
>=20
> I have to delete the following key from the registry.
>=20
> To restore the default hidden administrative shares, delete the
> AutoShareWks=20
> DWORD value in the following registry key, and then restart your
> computer:
>  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\LanmanServer\Para
> me ters
>=20
> Can someone point me in the right direction? Possibly a tutorial for
> doing this in perl.=20

Install the Win32::Registry2 patch from=20
http://Jenda.Krynicky.cz/#Win32::Registry2 and read the docs.
(The patch will become the next version of the module if a new=20
version of libwin32 ever gets released.)

Another option is Win32::TieRegistry.

You can restart the computer by
use Win32;
Win32::InitiateSystemShutdown( undef, "The machine goes down=20
dudes.", 10, 0, 1);

See
perldoc Win32

HTH, Jenda
=3D=3D=3D=3D=3D Jenda@Krynicky.cz =3D=3D=3D http://Jenda.Krynicky.cz =
=3D=3D=3D=3D=3D
When it comes to wine, women and song, wizards are allowed=20
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Report this thread to moderator Post Follow-up to this message
Old Post
adisegna@siscocorp.com
10-28-04 01:55 AM


RE: Editting the registry?
I have a Quick question about running the script as a logon script in
Windows using Active Directory. How?  When the user logs on the script
is run local. Obviously, I need Perl installed on the server to
interpret locally run scripts. If the user doesn't have Perl installed
locally how will it execute? Do I need to encapsulate the script inside
of WSH?  What are the other W2k admins doing? I am currently searching
for an answer now (google) but thought I would throw it on the list as
well.=20

Thanks


Arthur=20

-----Original Message-----
From: DiSegna Arthur=20
Sent: Wednesday, October 27, 2004 10:28 AM
To: Jenda@Krynicky.cz; beginners@perl.org
Subject: RE: Editting the registry?

Hey Jenda,

I am still trying to figure out the syntax/structure, etc of Perl but I
figured it out. Here is my simple script..=20

#!path\to\perl\
use Win32::Registry
$HKEY_LOCAL_MACHINE->DeleteValue($AutoShareWks);
=20
 Win32::Registry::DeleteValue('HKEY_LOCAL
_MACHINE\SYSTEM\CurrentControlSe
t\Services\lanmanserver\parameters', $AutoShareWks);

If someone has something different (easier or harder) let me know....=20

Thanks

Arthur=20

-----Original Message-----
From: Jenda Krynicky [mailto:Jenda@Krynicky.cz]=20
Sent: Tuesday, October 26, 2004 4:56 PM
To: beginners@perl.org
Subject: Re: Editting the registry?

Subject:        	Editting the registry?
Date sent:      	Tue, 26 Oct 2004 12:25:33 -0400
From:           	<adisegna@siscocorp.com>
To:             	<beginners@perl.org>

> I want to restore the default admin shares on a user's machine.
>=20
> I have to delete the following key from the registry.
>=20
> To restore the default hidden administrative shares, delete the
> AutoShareWks=20
> DWORD value in the following registry key, and then restart your
> computer:
>  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl
Set\Services\LanmanServer\Para
> me ters
>=20
> Can someone point me in the right direction? Possibly a tutorial for
> doing this in perl.=20

Install the Win32::Registry2 patch from=20
http://Jenda.Krynicky.cz/#Win32::Registry2 and read the docs.
(The patch will become the next version of the module if a new=20
version of libwin32 ever gets released.)

Another option is Win32::TieRegistry.

You can restart the computer by
use Win32;
Win32::InitiateSystemShutdown( undef, "The machine goes down=20
dudes.", 10, 0, 1);

See
perldoc Win32

HTH, Jenda
=3D=3D=3D=3D=3D Jenda@Krynicky.cz =3D=3D=3D http://Jenda.Krynicky.cz =
=3D=3D=3D=3D=3D
When it comes to wine, women and song, wizards are allowed=20
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--=20
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Report this thread to moderator Post Follow-up to this message
Old Post
adisegna@siscocorp.com
10-28-04 01:55 AM


RE: Editting the registry?
Perl2bat creates the batch file below. However, running it on my local
machine does not delete the registry key. Is there anything I'm missing?

@rem =3D '--*-Perl-*--
@echo off
if "%OS%" =3D=3D "Windows_NT" goto WinNT
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
perl -x -S %0 %*
if NOT "%COMSPEC%" =3D=3D "%SystemRoot%\system32\cmd.exe" goto endofperl
if %errorlevel% =3D=3D 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
goto endofperl
@rem ';
#!C:\perl\bin\perl=20
#line 15
use Win32::Registry
$HKEY_LOCAL_MACHINE->DeleteValue($AutoShareWks);
=20
 Win32::Registry::DeleteValue('HKEY_LOCAL
_MACHINE\SYSTEM\CurrentControlSe
t\Services\lanmanserver\parameters', $AutoShareWks);


__END__
:endofperl

Arthur=20
=20

-----Original Message-----
From: Jenda Krynicky [mailto:Jenda@Krynicky.cz]=20
Sent: Wednesday, October 27, 2004 11:31 AM
To: DiSegna Arthur
Subject: RE: Editting the registry?=20

From: <adisegna@siscocorp.com>
> I have a Quick question about running the script as a logon script in
> Windows using Active Directory. How?  When the user logs on the script
> is run local. Obviously, I need Perl installed on the server to
> interpret locally run scripts. If the user doesn't have Perl installed
> locally how will it execute? Do I need to encapsulate the script
> inside of WSH?  What are the other W2k admins doing? I am currently
> searching for an answer now (google) but thought I would throw it on
> the list as well.=20

You can install Perl on a server share and then wrap the script in a=20
.BAT (using the pl2bat script installed with ActivePerl) and map a=20
drive letter to the share as the first thing in the BAT and then run=20
the script.

That's what I used to do when I was an admin.

Jenda
=3D=3D=3D=3D=3D Jenda@Krynicky.cz =3D=3D=3D http://Jenda.Krynicky.cz =
=3D=3D=3D=3D=3D
When it comes to wine, women and song, wizards are allowed=20
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


Report this thread to moderator Post Follow-up to this message
Old Post
adisegna@siscocorp.com
10-28-04 01:55 AM


RE: Editting the registry?
From: <adisegna@siscocorp.com>
> Perl2bat creates the batch file below. However, running it on my local
> machine does not delete the registry key. Is there anything I'm
> missing?
>
> @rem = '--*-Perl-*--
> @echo off
> if "%OS%" == "Windows_NT" goto WinNT
> perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
> goto endofperl
> :WinNT
> perl -x -S %0 %*
> if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
> if %errorlevel% == 9009 echo You do not have Perl in your PATH. if
> errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto
> endofperl @rem '; #!C:\perl\bin\perl #line 15
>   use Win32::Registry
>   $HKEY_LOCAL_MACHINE->DeleteValue($AutoShareWks);
>
>  Win32::Registry::DeleteValue('HKEY_LOCAL
_MACHINE\SYSTEM\CurrentControl
> Se t\Services\lanmanserver\parameters', $AutoShareWks);
>
>
> __END__
> :endofperl

You should add some code that will create a log file or something
just to make sure the code was run.

You should also check whether the DeleteValue() succeeded.

It's possible that the account under which the script ran did not
have enough permissions to make the change.

If you will then run this from the login with Perl installed on a
server share you will have to modify the start of the BAT like this:

@rem = '--*-Perl-*--
@echo off
net use W: \\server\tools
if "%OS%" == "Windows_NT" goto WinNT
w:\perl\bin\perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
w:\perl\bin\perl -x -S %0 %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
goto endofperl
@rem ';
#!C:\perl\bin\perl
#line 16
...


Jenda
P.S.: Please do not CC: me on emails sent to the group.
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


Report this thread to moderator Post Follow-up to this message
Old Post
Jenda Krynicky
10-28-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:54 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.