How to assign computer startup scripts?

computer-startup-scripts

1. Open the Group Policy snap-in.
2. In the console tree, click Scripts (Startup/Shutdown). –

Where?

policy name Policy > Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)or Start the policy editor of the local group: Start Menu > Run > Type gpedit.msc

3. In the details pane, double-click Startup.
4. In the Startup Properties dialog box, click Add.
5. In the Add a Script dialog box, type the following information, and then click OK:

Script Name: Type the path to the script, or click Browse to search for the script file in the Netlogon share of the domain controller.

Script Parameters: Type any parameters that you want, the same way as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type the following: //logo //I

6. In the Startup Properties dialog box, specify the options that you want, as follows, and then click OK:

Startup Scripts for Group Policy object: Lists all the scripts that are currently assigned to the selected Group Policy object. If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

Edit: Opens the Edit Script dialog box, where you can modify script information, such as name and parameters.

Remove: Removes the selected script from the Startup Scripts list.

Show Files: Displays the script files that are stored in the selected Group Policy object.

Tagged : / / / / / / / / / / / /

A script to find all users who have not set passwords

a-script-to-find-all-users-who-have-not-set-passwords

Write a script to find all users who have not set passwords.

#!/usr/bin/ruby
require “P4”
p4 = P4.new
p4.parse_forms
p4.connect
p4.run_users.each do
|u|
user = p4.fetch_user( u[ “User” ] )
puts( user[ “User” ] ) unless user.has_key?( “Password” )
end
#!/

OR

#!/usr/bin/perl
use P4;
my $p4 = new P4;
$p4->ParseForms();
$p4->Init() or die( “Can’t connect to Perforce” );
foreach my $u ( $p4->Users() )
{
my $user = $p4->FetchUser( $u->{ “User” } );
print( $user->{ “User” }, “\n” ) unless defined ( $user->{ “Password” }
);
}

Tagged : / / / / / / / /

Script to list the clients in descending access date order

 

script-to-list-the-clients-in-descending-access-date-order

Write a script to list the clients in descending access date order (for deleting obsolete clients).

 

#!/usr/bin/ruby
require “P4”
p4 = P4.new
p4.tagged
p4.connect
clients = p4.run_clients.sort {|a,b| a[ “Access”].to_i <=> b[“Access”].to_i }
clients[0…10].each do
|c|
stamp = Time.at( c[ “Access” ].to_i )
printf( “%-20s %s\n”, c[ “client” ], stamp )
end

OR

#!/usr/bin/perl
use P4;
my $p4 = new P4;
$p4->Tag();
$p4->Init() or die( “Failed to connect to Perforce” );
my @clients = $p4->Clients();
@clients = sort { $a->{ “Access” } <=> $b->{ “Access” } } @clients;
@clients = @clients[ 0..9 ];
foreach my $client ( @clients )
{
last unless defined( $client );
my $stamp = localtime( $client->{ “Access” } );
printf( “%-20s %s\n”, $client->{ “client” }, $stamp );
}

Tagged : / / / / / / / / / / /