Showing posts with label Scripting. Show all posts
Showing posts with label Scripting. Show all posts

Tuesday, April 26, 2011

bench3

Pin To Start Menu And Task Bar For Default User

There are many possibilities to pin items to the start menu and task bar for the default user in windows 7 so that when a new user logs on, they have what’s been customized. 

The setting the Copy Profile to true doesn't seem to catch these customizations. I've been able to use the CopyProfile command to keep items that I've pinned to the Start Menu, but not the things that I've pinned to the Taskbar.

However, you can define up to five things that you want everyone to have pinned to their Taskbar using the unattend.xml files...that's one way of getting things there, unfortunately, that does not get rid of the "default" MS items that are already there (IE, MediaPlayer, etc).

Here's a way to do it using a script though:

http://blogs.technet.com/deploymentguys/archive/2009/04/08/pin-items-to-the-start-menu-or-windows-7-taskbar-via-script.aspx

You could in theory also configure these things using Group Policy Preferences.  There are two components to the Taskbar items, one is a registry key and the other is a file system shortcut.  The registry keys define what is there and in what order the items appear on the taskbar.  If you use GPP you could set both of those things up for all new profiles.

However, I'm leaning towards using the script and something like Active Setup which will allow you to run a one-time command for every new user that logs in to a box.  That way I can remove the things I don't want and add in the ones that I do...

Surely Microsoft should be able to come up with a better way of customizing the taskbar and start menu for users.

Read More

Wednesday, December 1, 2010

bench3

OLE Control Extensions | What Are OCX Files

.OCX - OLE Control Extensions: In the 1990s Microsoft introduced the concept of Object Linking and Embedding, or OLE, to provide interaction among various programs that need to share data. OLE provides various functions, like the ability to drag and drop data between two applications. It also allows users to embed components from one file inside another, thus producing compound documents.

In this architecture, which is part of the Component Object Model or COM, OLE Control Extensions (OCX files) are used to provide control features such as handling scroll bar movement and window resizing. OCX is the second generation of this control architecture, with VBX (Visual Basic Extensions) being the first. This said, the OCX model has been superseded by ActiveX, though backward compatibility is maintained in order to support the previous architecture and applications developed under it.

OCX files frequently are nothing more than Dynamic Link Library files (DLLs) with the special .ocx extension. They contain the custom controls available to a given application. The advantage of this architecture is the same as that provided by the DLL model – it allows developers to create shareable code that can be imported into multiple applications

Users of Microsoft Windows may find many instances of files with the .ocx extension scattered around their PCs. In general, these files are benign and should not be deleted since doing so may render the application to which they're linked inoperable. Obviously it's possible for a malware application to make use of the .ocx extension, and scenarios may exist in which a legitimate OCX file has been hijacked by malware in order to infiltrate a user's machine.

As always, you should obtain and run a reliable malware/virus scanner with a current set of definition files if you suspect your machine has been infected or compromised in any way.
Read More

Tuesday, November 30, 2010

bench3

Exclude Domain Users In Offline Migration

While attempting to migrate a user profile using USMT 4 offline migration, you must specify the domain user account to include by sid when performing an offline USMT migration.

But, instead of specifying a user account to include, what if you need to specify user accounts to exclude. If you do that without much knowledge, Unfortunately it will migrating all the accounts even the local accounts that you have specified to exclude. 
Here is an example of such wrong scanstate command:
scanstate S:\offline /offlinewindir:C:\Windows /i:Config.xml /w:5 /c /v:1 /config:config.xml /ue:LocalAccount /ue:"SID of domain account to exclude" /uel:90 /efs:skip /l:S:\Offline\Logfiles\Offline.log
Is it possible to exclude user accounts in an offline scanstate migration? is it possible to exclude as required?

Solution:  
It is able to exclude the user accounts in an offline scanstate migration.
In your scanstate command, please note that The /uel option is not valid in offline migrations.

References:
Read More

Monday, September 20, 2010

bench3

StartUp Script To Remove IE Favourites On All Clients On A Domain

StartUp Script To Remove Internet Explorer Favourites On All Clients On A Domain: Have you ever seen Bilt In Internet Shortcuts In Microsoft Windows Operating System like what you see in the below screen shot? Well, Though it may not taku up any space in your disk, users may want it to be removed from their system. The reason can be plenty.... 
Anyhow, All those shortcuts can be deleted manually on each system. But is there any way to automate the removal of these shortcuts, perhaps via a group policy or a batch file/script, so that the users never see them? Well, it can be done. And if you want to perform a domain wide removal of Internet Explorer 6 Favourites shortcuts such as 'msn.com and 'Windows Marketplace', here is a simple batch file.

SCRIPT: Add this to your users login script it will check for the first shortcut and remove if it is there and check for the second shortcut and remove if it is there. Please change the names of the shortcuts in the script to the one you want to remove. 
batch file.
if not exist %USERPROFILE%\Favourites\shortcut1.url GOTO NODELETE1
del /s /q "%USERPROFILE%\Favourites\shortcut1.url"
NODELETE1:

if not exist %USERPROFILE%\Favourites\shortcut2.url GOTO NODELETE2
del /s /q "%USERPROFILE%\Favourites\shortcut2.url
NODELETE2:
Read More

Thursday, August 19, 2010

bench3

How To Make A StartUp Script In Windows | Using Startup Scripts

DIFFERENT WAYS YOU CAN MAKE A STARTUP SCRIPT IN WINDOWS
The process of making a startup script—a script that is executed automatically when Windows starts—is quite simple. Essentially, you create an ordinary PowerShell Script, batch file, or any other type of script and then take steps to have it executed when Windows starts. There are a few different ways to do this:

Use the Startup folder
Put a shortcut to the script in your Startup folder (usually C:\Users\{username}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup). 

This is by far the easiest to implement, but also the most fragile, because it’s equally easy to disable. 

If there is more than one user account on a computer, and you want the script to be executed regardless of the currently logged-in user, you can use the “All Users” Startup folder (usually C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup) instead. 

Use the Registry
Open the Registry Editor and expand the branches to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. 

Select New and then String Value from the Edit menu, and type startup script. Double-click the new Startup Script value, type the name of your script (e.g., c:\scripts\myscript.vbs), and click OK. Although it’s a bit harder to implement, this setup is a little more buried, and thus more difficult for unwitting users to mess up than items placed in the Startup folder.

Many viruses and spyware install themselves in this Registry key precisely because it’s so transparent.for tips on how to remove malware from this key.

Likewise, you can implement this solution for all users rather than just the current user by adding the Registry value to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run instead.

Use the Group Policy Editor
This is probably the coolest solution, as it gives you the most control over precisely when the script is run, and it’s the only way to facilitate a shutdown or logoff script as well. Open the Group Policy Editor (gpedit.msc), and expand the branches to Computer Configuration\Windows Settings\Scripts Startup/Shutdown). 
Double-click the Startup entry on the right side, and then click Add. Click Browse to locate a script file, and click OK when you’re done. The script will be run every time you start your computer, but before the logon or Welcome screen appears (and before scripts specified in the Registry or Start menu are ever run).

Likewise, double-click the Shutdown entry to specify a script to be run every time your computer shuts down. Now, there’s a similar setting called Scripts (Logon/Logoff), located in the User Configuration branch. Like everything in the User Configuration branch, these settings apply only to the currently logged-on user (as opposed to all users). If you specify your startup script here (under Logon), instead of under Computer Configuration, the script will run after you log in. And, of course, a script specified under Logoff will be run when you log off, whether or not you actually shut down the computer. 

StartUp Script
A startup script can contain a list of programs that you want to run in a specific order when Windows starts, such as connecting to the Internet and then checking your email. (Neither Explorer’s Startup folder nor the Registry allow you to choose the order in which programs are run.) But there are other, less apparent uses for a startup script, such as for security or remote administration. 

For example, say you’ve discovered malware that has infected some or all of the computers on a network. By writing a script that eliminates the malware by deleting key files or running a removal utility and setting it up as a startup script, you can effectively eliminate it from each computer.
But with scripts, you can take it even further: utilize a single script stored on a single computer that is run, over the network, on all computers. This way, you can make changes to the script once and have those changes propagated to all computers effortlessly. So, if you place the script Startup.vbs on a machine called Server in a folder called C:\scripts (drive C: would be shared as “C”), then each client machine should be configured to automatically execute \\server\c\scripts\startup.vbs (using one of the above mentioned methods). 
The beauty of this is that when you don’t want the script to do anything, you can simply leave it intact yet empty. If you find that you need to, say, make a Registry change or copy a group of files onto each computer, just type the appropriate commands into the script and turn on (or reboot) all the client computers. 

This can turn some administration tasks into very short work.
Read More

Sunday, November 15, 2009

bench3

Tips On Scripting And The UAC In Windows Vista And Windows 7

When writing scripts for use in Vista / windows 7, you’ve always got to think about security and the User Access Control (UAC) feature.

For instance, with Vista / seven set to its defaults, any applications you launch with a script will be run under the standard (limited) user account. If your script needs to open applications and issue commands (such as the Registry functions ) as the administrator, then your script needs to be run under the administrator account.

You can set wscript.exe to always run in administrator mode, but this would cause all scripts to run under the administrator account, and would open up a nasty vulnerability on your PC. So, what to do?

Unfortunately, you can’t right-click a .vbs file and select Run as administrator, as you can with executables (.exe files). But you can get around this limitation in a few different ways.

First, you can write a one-line batch file (discussed later in this artile) that does nothing more than launch your script. Then, to run the script in administrator mode, right-click the batch file and select Run as administrator.

Or, to run all your scripts in administrator mode without making your system vulnerable, make a copy of the wscript.exe file called something like wscript_admin.exe. Right-click the wscript_admin.exe file, select Properties, choose the Compatibility tab, and then turn on the Run this program as an administrator option.

Next, add a new file type for .vbsa files and associate its Open action with the wscript_admin.exe file. Thereafter, just rename the filename extension of any .vbs file to .vbsa to run the script as an administrator.

Batch Files
When it comes to quick and dirty scripting, it’s hard to beat DOS batch files. Batch files, similar to WSH scripts (discussed earlier in this chapter), are plain-text files with the .bat or .cmd filename extension. However, rather than relying on a complex, unfamiliar scripting language, batch files simply consist of one or more DOS commands, typed one after another.

One of the problems with Windows-based scripting is that it tries to control a graphical environment with a command-based language. Because DOS is a command-based interface, DOS-based scripting (batch files) is a natural extension of the environment.

Consider the following four DOS commands:
c:
cd \windows\temp
attrib -r *.tmp
del *.tmp
If you type these commands into a plain-text editor, such as Notepad, save them into a .bat file, and then execute the batch file by double-clicking or typing its name at the Command Prompt, it will have the same effect as if the commands were manually typed consecutively at the prompt. Obviously, this  can be a tremendous time saver if you find yourself entering the same commands repeatedly.
When you run a batch file, each command in the file will be displayed (echoed) on the screen before it’s executed, which can be unsightly for the more compulsive among us. To turn off the echoing of any given command, precede it with the @ character. To turn off the printing of all commands in a batch file, place the command @echo off at the beginning of the batch file.
To run a batch file, double-click its icon in Explorer or, if it’s in the current working directory (folder), you can type its name at the Command Prompt. You’ll want to put more frequently used, general-purpose batch files in a folder specified in the system path, so that they can be executed regardless of the current working directory.

Although batch files can run Windows programs (just type notepad to launch Notepad), it’s preferable to run Windows programs with WSH scripts, because they’ll be able to run without having to first load a Command Prompt window.

In addition to the standard DOS commands, batch files use a couple of extra statements to fill the holes. Variables, conditional statements, and for...next loops are all implemented with statements that are ordinarily not much use outside of batch files.
Read More