21 de jan. de 2011

10 fundamental concepts for PowerShell scripting

10 fundamental concepts for PowerShell scripting: "

PowerShell scripts offer a handy way to automate various chores. Here are some key concepts that will help beginners as they start developing PowerShell scripts.


Note: This article is also available as a PDF download.


1: PS1 files


A PowerShell script is really nothing more than a simple text file. The file contains a series of PowerShell commands, with each command appearing on a separate line. For the text file to be treated as a PowerShell script, its filename needs to use the .PS1 extension.


2: Execution permissions


To prevent the execution of malicious scripts, PowerShell enforces an execution policy. By default, the execution policy is set to Restricted, which means that PowerShell scripts will not run. You can determine the current execution policy by using the following cmdlet:


Get-ExecutionPolicy

The execution policies you can use are:



  • Restricted - Scripts won’t run.

  • RemoteSigned - Scripts created locally will run, but those downloaded from the Internet will not (unless they are digitally signed by a trusted publisher).

  • AllSigned - Scripts will run only if they have been signed by a trusted publisher.

  • Unrestricted - Scripts will run regardless of where they have come from and whether they are signed.


You can set PowerShell’s execution policy by using the following cmdlet:


Set-ExecutionPolicy <policy name>

3: Running a script


For years now, if you wanted to run an executable file from the command line the practice was to navigate to the file’s path and then type the name of the executable file. However, this age-old method doesn’t work for PowerShell scripts.


If you want to execute a PowerShell script, you will usually have to type the full path along with the filename. For example, to run a script named SCRIPT.PS1, you might type:


C:\Scripts\Script.ps1

The big exception is that you can execute a script by simply typing its name if the folder containing the script is in your system’s path. There is also a shortcut you can use if you are already in the folder containing the script. Instead of typing the script’s full path in such a situation, you can enter .\ and the script’s name. For example, you might type:


.\Script.ps1

4: Pipelining


Pipelining is the term for feeding one command’s output into another command. This allows the second command to act on the input it has received. To pipeline two commands (or cmdlets), simply separate them with the pipe symbol (|).


To help you understand how pipelining works, imagine that you want to create a list of processes that are running on a server and sort that list by process ID number. You can get a list of processes by using the Get-Process cmdlet, but the list will not be sorted. However, if you pipeline the cmdlet’s output into the Sort-Object ID command, the list will be sorted. The string of commands used looks like this:


Get-Process | Sort-Object ID

5: Variables


Although you can use pipelining to feed one command’s output into another command, sometimes pipelining alone won’t get the job done. When you pipeline a command’s output into another command, that output is used immediately. Occasionally, you may need to store the output for a while so that you can use (or reuse) it later. This is where variables come into play.


It’s easy to think of a variable as a repository for storing a value, but in PowerShell, a variable can store a command’s full output. For example, suppose you want to store the list of processes running on a server as a variable. To do so, you could use this line of code:


$a = Get-Process

Here, the variable is named $a. If you want to use the variable, simply call it by name. For example, typing $a prints the variable’s contents on the screen.


You can assign a variable to the final output of multiple commands that have been pipelined together. Just surround the commands with parentheses. For example, to sort the running processes by process ID and then assign the output to a variable, you could use this command:


$a = (Get-Process | Sort-Object ID)

6: The @ symbol


By using the @ symbol, you can turn the contents of a list into an array. For example, take the following line of code, which creates a variable named $Procs that contains multiple lines of text (an array):


$procs = @{name='explorer','svchost'}

You can also use the @ symbol when the variable is used, to ensure that it is treated as an array rather than a single value. For instance, the line of code below will run the Get-Process cmdlet against the variable I defined a moment ago. In doing so, Windows will display all the processes used by Windows Explorer and Svchost. Notice how the @ symbol is being used in front of the variable name rather than the dollar sign that we usually see used:


Get-Process @procs

7: Split


The split operator splits a text string based on a character you designate. For example, suppose that you want to break a sentence into an array consisting of each individual word in the sentence. You could do so by using a command like this one:


'This is a test' -split ' '

The result would look like this:


This

is

a

test

8: Join


Just as split can split a text string into multiple pieces, the join operator can combine multiple blocks of text into one. For example, this line will create a text string consisting of my first name and last name:


'Brien','Posey' -join ' '

The space between the quotation marks at the end of the command tells Windows to insert a space between the two text strings.


9: Breakpoints


Running a newly created PowerShell script can have unintended consequences if the script contains bugs. One way to protect yourself is to insert breakpoints at strategic locations within your script. That way, you can make sure that the script is working as intended before you process the entire thing.


The easiest way to insert a breakpoint is by line number. For instance, to insert a break point on the 10th line of a script, you could use a command like this:


New-PSBreakpoint -Script C:\Scripts\Script.ps1 -Line 10

You can also bind a breakpoint to a variable. So if you wanted your script to break any time the contents of a$ changed, you could use a command like this one:


New-PSBreakpoint -Script C:\scripts\Script.ps1 -variables a

Notice that I didn’t include the dollar sign after the variable name.


There are a number of verbs you can use with PSBreakpoint including New, Get, Enable, Disable, and Remove.


10: Step


When debugging a script, it may sometimes be necessary to run the script line by line. To do so, you can use the Step-Into cmdlet. This will cause the script to pause after each line regardless of whether a breakpoint exists. When you are done, you can use the Step-Out cmdlet to stop Windows from stepping through the script. It is worth noting, however, that breakpoints are still processed even after the Step-Out cmdlet has been used.


Incidentally, if your script uses functions, you may be interested in the Step-Over cmdlet. Step-Over works just like Step-Into, except that if a function is called, Windows won’t step through it. The entire function will run without stopping.


Additional resources







"

20 de jan. de 2011

Access the real Administrator account in Windows 7

Access the real Administrator account in Windows 7: "

As you know, the User Account Control (UAC) system is the heart and soul of the security system in Microsoft Windows 7. It is designed to protect your system from inadvertent or malicious incidents that could compromise stability or security while you are logged on using an account with administrative privileges, where you have full access to the system. Of course, you can perform administrative operations simply by working through the UAC prompt. Or, if you totally dislike the UAC system, you can also easily disable it. For example, you can select the Never Notify setting on the User Account Control Setting window.


However, there certainly are times when it would just be nice to log on to your Windows 7 system with a good old fashioned full-fledged Administrator account. When you do, you’ll never encounter a UAC prompt.


In this edition of the Windows Desktop Report, I’ll explain how you can activate and use the real Administrator account in Windows 7.


This blog post is also available as a TechRepublic Photo Gallery and TechRepublic Download.


Caveat


Now keep in mind that Microsoft has gone to great lengths to prevent you from using the real Administrator account and as you can imagine, strongly discourages the technique I’m about to show you here. As such, I must emphasize that you should use the real Administrator account very sparingly - never make it your default modus operandi! With that being said, I also have to say that you use this technique at your own risk.


Activating the account


While you might think that since Microsoft discourages the use of Windows 7’s Administrator account, that it is hidden deep within the bowels of the operating system. However, that’s not the case at all. In fact, to find the Administrator account you have to look no further than the Local Users and Groups tool.


To begin, open the Start menu, right-click the Computer icon, and select Manage from the context menu. When you see the Computer Management console, go to the navigation panel on the left and click the arrow next to Local Users and Groups to expand the branch. Then, click the Users folder. At this point you can see and select the Administrator account as shown in Figure A.


Figure A



Select the Administrator account.

With the Administrator account selected, click More Actions under Administrator in the Actions panel on the right and select Properties from the menu, as shown in Figure B.


Figure B



Use the More Actions menu to access the Properties command.

When you see the Administrator Properties dialog box, just clear the Account is Disabled check box, as shown in Figure C, and click OK.


Figure C



The Administrator account is disabled by default.

Keep in mind that now that the Administrator Account is activated you can also work with the account in the User Accounts tool in the Control Panel.


Setting the password


By default, the Administrator account has a blank password, so the first order of business after activating the account is to set a password - preferably a complex password consisting of at least eight characters and using uppercase, lowercase, and numbers or special symbols.


With the Administrator account selected, click More Actions under Administrator in the Actions panel and select the Set Password command. You will be shown a warning that explains that resetting a password from outside the account itself can cause irreversible loss of information, as shown in Figure D.


Figure D



When you select the Set Password command, you will see this warning.

However, since the Administrator Account has never been used, you can click Proceed with impunity. When you do, you’ll see the Set Password dialog box, shown in Figure E, and can type the new password in both text boxes. Then, click OK.


Figure E



You will be prompted to type the password for the Administrator account.

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic’s Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!


Logging in as the Administrator


Now that you’ve activated the Administrator Account and set the password, using the account is as simple as logging off. When the Log Off operation completes, you’ll see the Welcome screen and you will see a user icon for the Administrator Account, as shown in Figure F. To log on as the Administrator, just click the icon and provide the correct password.


Figure F



You will now see the Administrator account on the Welcome page.

When you do, you’ll never encounter a UAC prompt. Again, I must emphasize that you should use the real Administrator account sparingly and never make it your default mode of operation!


What’s your take?


As you can see, it’s a relatively easy operation to activate the real Administrator account in Windows 7 once you know the technique. Now that you know how it’s done, are you likely to use the Administrator account? Have you disabled UAC? If so, do you think that you’ll re-enable it and use this technique instead? As always, if you have comments or information to share about this topic, please take a moment to drop by the TechRepublic Community Forums and let us hear from you.





"

Microsoft Attack Surface Analyzer, Validate Apps Before Release, Deployment

Microsoft Attack Surface Analyzer, Validate Apps Before Release, Deployment: "

Microsoft has released a free tool for 32-bit and 64-bit editions of Windows that they have been using internally only for some time. The Attack Surface Analyzer assists “both testers and IT Pros in assessing the security of an application”. It does so by highlighting “the changes in system state, runtime parameters and securable objects on the Windows operating system” after the installation of new programs.

The tool takes two snapshots of the system, one before the installation and one after the installation. It compares the two snapshots to identify the changes. It looks in particular for “classes of security weaknesses as applications are installed on the Windows operating system”.

In addition, Microsoft Attack Surface Analyzer “gives an overview of the changes to the system Microsoft considers important to the security of the platform and highlights these in the attack surface report”.

The program stores the report in a cab file. The start page offers to run a new scan or to generated a report by comparing a previous scan with a new scan.

attack surface analyzer

Each scan performs several tasks, like enumerating files, handles or services. Some operations may take a while or show up as pending if they have not been started by the application.

The report is launched in the default web browser, a short explanation is available as well.

attack surface report

Attack Surface Analyzer is available as a 32-bit and 64-bit application at Microsoft.com. Please note that the application has been released as beta. Reports can be generated on Windows Vista, Windows 7 and Windows Server 2008 R1 and R2. The analysis of the data and report generation requires the Microsoft .NET Framework 3.5 in addition.


© Martin for gHacks Technology News, 2011. | Permalink | Add to del.icio.us, digg, facebook, reddit, twitter
Post tags: , , ,

"

When "open source" software isn't truly open source

When "open source" software isn't truly open source: "

Richard Stallman may have kick-started the Free Software and open source software community, but the Open Source Initiative was founded in 1998 by Bruce Perens and Eric Raymond to offer an alternative approach to defining and promoting the same software development processes and licenses, and that approach has gotten the lion’s share of public recognition since. Free Software is a term that both promotes Stallman’s ideological goals regarding how software is distributed, thus turning off business-oriented software users who disagree with Stallman’s ideology, and manages to conflate itself with software that simply doesn’t cost anything. Perens and Raymond coined the term “open source software” to refer to software developed under essentially the same conditions as Stallman’s Free Software definition.


Once the term “open source software” was coined, it was also defined. The official Open Source Definition is clear, and explains how software must be licensed to qualify as open source software. The specific points of the Definition address issues related to:



  1. Redistribution

  2. Source Code

  3. Derived Works

  4. Integrity of the Author’s Source Code

  5. No Discrimination Against Persons or Groups

  6. No Discrimination Against Fields of Endeavor

  7. Distribution of License

  8. License Product Specificity

  9. License Restrictions on Other Software

  10. License Technology Neutrality


A summary of the effect of the conditions mandated by that Definition is available in the Wikipedia article about open source software:


Open-source software (OSS) is computer software that is available in source code form for which the source code and certain other rights normally reserved for copyright holders are provided under a software license that permits users to study, change, and improve the software.


Unfortunately, the fact is that many people misuse the term “open source software” when referring to their own software. In the process of looking for a decent dice roller IRC bot in 2010, I came across one called Bones. On the announcement page for it, Bones: Ruby IRC Dicebot, its author said the dicebot is:


Free: Like most IRC bots, Bones is open source and released free of charge.


In subsequent email discussion with its author, it turned out that his definition of “open source” is substantially different from that of the Open Source Initiative, me personally, and the entire open source community — to say nothing of Microsoft, Oracle, tech journalists, and just about everybody else who uses the term:



Question: You said in your page for bones that “Like most IRC bots, Bones is open source and released free of charge.” What open source license are you using for it?


I haven’t released it under any particular open source license. It’s only open source in so far as it isn’t closed source.


In an attempt to clarify the legal standing of the IRC bot, I asked further:



Any chance I could get you to let me do stuff with it under a copyfree license (my preference is the Open Works license, though BSD and MIT/X11 licenses or public domain are great too) so I can hack on yours a bit rather than just having to start over from scratch?


I don’t plan on releasing it under a license, but that shouldn’t stop you from making changes to the code if you like.


Of course, if I have the source in my possession — which is pretty much a given for any Ruby program — I can indeed make changes to it if I like. The point he ignored is that without a license setting out what permissions the copyright holder grants to recipients of the code, these recipients cannot legally share changes with others. This effectively made any interest I had in improving his program dry up and blow away. It also effectively means that when he called it “open source”, he made an error either of ignorance or of deception. When I pointed out to him the legal problems involved, he declined to respond.


There is some argument to be made as to whether a license that conforms to the requirements of the Open Source Definition should be called an “open source” license even if it has not been certified by the OSI itself. Many of us are inclined to regard a license as an open source license if it obviously fits the definition, regardless of certification. By that standard, the Open Works License and (Note: The full name of the WTFPL may not be safe for reading at work, depending on your workplace. Be careful clicking on the link) WTFPL are open source licenses. By the standards of the list of OSI approved licenses, however, they are not — because the OSI requires an extensive review process that lies somewhat outside the range of what many would-be license submitters have the time and resources to pursue.


Let us for argument’s sake accept that merely conforming to the Open Source Definition is sufficient to call a license “open source”, regardless of official approval by the OSI. By contrast with the Bones IRC bot, then, an IRC bot called drollbot (part of the larger droll project) that I wrote from scratch to serve much the same purpose as Bones actually is open source software, released under the terms of the Open Works License.


The simple comparison of Bones with drollbot serves to illustrate the difference between what really is open source software and what only pretends to be. The pretense, in this case, is an example of something many people call “source-available software”, where the source code is available but recipients are granted no clear legal permission to modify, redistribute, and even sell the software if they so desire — requirements of both the Open Source Definition and the Free Software Foundation’s definition of Free Software.


There are many other concerns related to how we classify software and the licenses under which we distribute it, but many of them are secondary to the simple necessity of understanding what is or is not open source software at its most basic level. Whether or not you consider a piece of software to qualify as “open source software” if the license under which it is distributed has not been officially approved by the OSI, one thing is clear. That is the fact that before you go around telling people to download your “open source software”, you should give them assurances of the most basic requirement of open source software as differentiated from software that has merely been written in a language traditionally run by an interpreter rather than compiled to an executable binary:


When you call something “open source software”, you must give all recipients a guarantee that they may modify and redistribute the software without fear of lawsuits for copyright violation. If you do not do that, by way of a license that conforms to the Open Source Definition or by releasing the software into the public domain, what you give them is not open source software. Period.





"

19 de jan. de 2011

Sending a job to the background and back to the foreground in Linux

Sending a job to the background and back to the foreground in Linux: "

From the Linux command line you can send a running job into the background which will return your bash prompt to you. You might need that prompt to quickly run another command, or you might just want to let that command run in the background for a while and do not need to view the output. Either way, you can send that command to the background and then, when you need it again, bring that same running command back into the foreground. Let’s take a look at how this is done.

The job

First things first, I am going to create a very simple job so you can practice this task on. Let’s create a file with some very simple contents. Do the following.

  1. Open up a command prompt.
  2. Enter the command echo "this is my test file" > ~/test_file.
  3. Issue the command less ~/test_file to make sure the previous command worked.

You should now have a very simple test file with a single line of content. That’s the file we are going to work with.

The commands

There are two commands we are going to work with:

  • bg: Lists the current zombied programs.
  • fg: Brings a zombied command to the foreground.

Before we continue I should probably explain a couple of things. First, a zombied program is a program (or command) that has been sent to the background. In order to do this you must issue the command in the terminal window and, while the command is running, hit the Ctrl-z combination. When you do this the command output (or just the command if it is not returning any output) will disappear and return you to your bash prompt.

So…let’s use our sample we created above. If you look at your terminal window, you should still see the contents of the ~/test_file, which will read “this is my test file”. That should be the only thing you see. You do not have access to your bash prompt so you can’t run any more commands from that terminal window. Hit the Ctrl-z key combination and the contents of the file returns and the contents of the file are “gone”. The command less is now in the background.

Now, to see what commands are currently in the background enter the command bg. You should see something like:

[1]+ Stopped less test_file

To bring that command back you would issue the command fg less. That will return the contents of the ~/test_file back to your terminal window. Now, if you close that command (in the case of the less command hit the q key to quit) and you issue the command bg you will not see that particular command listed among any background commands you have.

NOTE: The bg command will not take into account any system daemons you have running. This command ONLY takes into account the commands your particular user has placed into the background.

Final thoughts

You might not be able to come up with any useful need for this nice Linux feature right away. But some time you are going to be working in the terminal window and you will need to do exactly what is prescribed above.


© Jack Wallen for gHacks Technology News, 2011. | Permalink | Add to del.icio.us, digg, facebook, reddit, twitter
Post tags: , ,

"

17 de jan. de 2011

Tips on delivering bad news to clients

Tips on delivering bad news to clients: "

Many doctors go into their field because they have a desire to help others; likewise, technology professionals often turn to consulting to marry their love of technology and problem solving. But sometimes things go very, very wrong. Physicians are trained in delivering bad news, but most consultants aren’t. IT consultants can take some lessons from physicians when it comes to informing clients that workstations or servers require replacement, an office must immediately replace pirated productivity software site-wide, or critical data has been irrevocably lost.


Six-step process


Medical professionals often adopt a six-step process for delivering bad news. The protocol, as advocated by University of Toronto oncologist Dr. Robert Buckman and instructed and practiced by others, is essentially as follows:



  1. Prepare the setting

  2. Discover what the patient knows

  3. Learn how much the patient wants to know

  4. Share information

  5. Respond to the patient’s reactions

  6. Determine specific next steps


IT consultants should adopt a similar communications method. Most technology professionals can determine the cause of an IT failure and prescribe recommended fixes, but the manner in which this information is communicated can make the difference between solving a critical issue once and becoming a long-term business partner.


1: Prepare the setting


Initial conversations about bad news should occur in private where sensitive information about the client’s network, systems, or security is not overheard by unauthorized staff or customers. Before discussions begin, you should ask the client who else should be present. For example, the CFO, accountant, or another partner might need to be in the room when findings and recommendations are reviewed.


2: Find out how much the client knows


You might learn that the client has been using the same domain controller for nine years; they’ve neglected desktops by attempting to keep six year-old systems in service; or they’re aware they never invested in monitoring or testing backup systems.


This step is also an opportunity for you to determine the client’s level of technical sophistication, as well as their emotional state and expectations. Client anxiety and desperation directly translates to how much pressure your office will feel when obtaining replacement equipment, securing new licensing, and installing, configuring and testing. After years of managing a consultancy, I believe this element creates more stress of consultancies than any other business item, including accounting, making payroll, or competing for new projects.


3: Find out how much the client wants to know


Some clients simply don’t want that much detail. They don’t want to know that the domain controller’s toast and no system backup exists. They don’t care you have to recreate a new Active Directory structure, redesign the domain, reverse engineer DNS and IP settings. Other clients will want every detail. You can save everyone involved time by asking clients upfront how much information they want.


4: Share the information


Explain what broke and why it broke (if the why is known). Without emotion or any told-you-so nuance, describe your diagnosis, disclose the evidence found that led to that diagnosis, and keep your statements short and succinct. Avoid using technical jargon, and stop frequently to ask the client if they understand the information you’re providing.


5: Respond to the client’s reaction


I’ve seen clients react to bad news in very different ways. Some clients break down in tears; some become animated and shout; while others ask what it’s going to cost and when will it be completed. If clients seem to have no reaction to your news, ask them what they’re thinking.


Physicians use a technique described as empathic response, in which they acknowledge a patient’s emotions to show they recognize the cause and possess an understanding. Consultants should do the same.


6: Determine specific next steps


You must tell clients (and possibly write down) the next steps and corresponding costs necessary to address the crisis — there should be no gray areas here. The client should have a clear understanding of who is going to do what at the scheduled time. For example, with the client’s approval, you could make sure they know your office will order a new rack-mount server this afternoon, the unit will arrive next Tuesday, your office will prepare its deployment on Wednesday, and operation should be restored Thursday, with payment for hardware and services due two weeks from Friday.


Crises are opportunities


Unplanned outages, unanticipated downtime, failed systems, and other crises present an excellent opportunity for IT consultants to forge strong, long-term relationships with clients. But only by recognizing the stress and emotions that come to the surface during such crises, and effectively communicating throughout the entire process, can consultants minimize anxiety and position themselves as a long-term partner as opposed to an opportunistic technical services provider.







"

RedRiot is a high-performance shooter -- Time Waster

RedRiot is a high-performance shooter -- Time Waster: "
redriot

I often enjoy writing about minimalistic, retro-style time-wasters. You know, games that seem to come from a simpler time, when graphics was very basic, and it was all about speed and gameplay.



Well, RedRiot is one exception. The graphics here are nothing but basic, and accordingly, this game takes a while to load. Once it loads, though, it's great fun. You're a super-warrior floating around the screen with a jetpack, and each level is a 'mission' with its own objective. You're may be called upon to destroy a couple of radar towers, or perhaps several missile silos, etc.



As you go about your business, the enemy will try to stop you. At first, there are only tanks that roll around on the ground and shoot up at you. But fairly soon, you start getting drones that fly around the screen, shoot at you and do their best to make your life difficult.



There's a shop at the end of each level, and you can buy extra damage, extra lives, improved accuracy and all sorts of goodies. This is a great game for when you want a time-waster, but not one that looks like it was made in 1980.

RedRiot is a high-performance shooter -- Time Waster originally appeared on Download Squad on Mon, 17 Jan 2011 12:00:00 EST. Please see our terms for use of feeds.

Permalink | Email this | Comments

"

14 de jan. de 2011

Quick Tip: Create a new partition with Windows 7 tool

Quick Tip: Create a new partition with Windows 7 tool: "

In a previous blog post, I described how to use the Microsoft Windows 7 Disk Management tool to shrink an existing hard drive volume: “Quick Tip: Shrink a Hard Drive Volume in Windows 7.” Once you have shrunk a volume, you can then establish a new partition on the newly empty space and create a new logical hard drive for your Windows operating system. Here are the steps to make that happen.


This blog post is also available as a TechRepublic Photo Gallery and TechRepublic download.


Disk Management


As in the previous post, the first step is to start the Windows 7 Disk Management tool with elevated administrative rights. Click the Start menu button and type diskmgmt.msc into the search box and then right-click the diskmgmt.msc entry to get to the Run as Administrator item in the context menu, as shown in Figure A.


Figure A



Open the Disk Management Tool with administrative rights.

Clicking Run as Administrator will load the Disk Management Tool, which will look something like Figure B. As you can see, we have some empty space to work with after shrinking the volume previously.


Figure B



There is empty space to fill.

Right-click on the empty area to get the context menu and then navigate to the New Simple Volume menu item, which will start the appropriate wizard (Figure C).


Figure C



Start the New Simple Volume Wizard.

Click Next on the Welcome screen (Figure D) to start the process.


Figure D



The Welcome screen starts the process.

You can take the empty space and divide it into several drives, but in our example, I am going to use the remaining space for the new simple volume (Figure E).


Figure E



Specify the volume size.

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic’s Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!


On the next screen in the wizard you are asked to assign a drive letter or path to the new volume (Figure F). You have three choices:



  • Assign the following drive letter: Windows has suggested the next available drive letter. This is the default and will most often be the preferable choice.

  • Mount in the following empty NTFS folder: Instead of using a drive letter you can mount the drive to a folder. This essentially makes the drive look like and operate like a folder in Windows.

  • Do not assign a drive letter or drive path: You will have to assign a letter or path later in order to make the drive usable for storage.


We’ll just stick with the default and make a new drive E.


Figure F



Assign a drive letter or drive path.

The screen in the wizard deals with formatting our new drive (Figure G). In general, you should choose to format this drive under the NTFS file system; however, you can also choose to use FAT32. The other default setting should not be used unless you know have a specific reason to change the allocation size.


You should give your new drive a label to help you distinguish the new drive from other drives on your system. A quick format will take less time, but it will not find and mark bad sectors on your drive that could cause problems later.


NTFS drives have built-in compression systems that are essentially seamless to users and can be a good choice if storage space is a premium.


Figure G



Set the formatting options.

The last screen in the wizard (Figure H) gives you a summary of your choices and the opportunity to step back and make changes. When you are satisfied with your choices, click the Finished button.


Figure H



Click Finish to create your drive.

When the formatting is complete, you will have a new drive visible to Windows 7 and ready to store your files (Figure I).


Figure I



A new drive is available.




"

13 de jan. de 2011

10 workplace rules of engagement

10 workplace rules of engagement: "

Here’s a thought. What if we all admit to being imperfect? While we strive to be good employees, good coworkers, and good bosses, sometimes we’re not. Sometimes the stresses of the modern world get to us and we’re not proud of our behavior. It doesn’t mean we’re bad people, it just means we’re normal human beings.


Instead of making believe that everyone else is “the problem” and painting a big fat bull’s-eye on the boss, calling each other a**holes, or acting out like spoiled children, how about we all fess up, admit that we can do better, and actually deal with the situation. I mean, wouldn’t that be more productive?


Just to be clear, I’m not just talking about behavior that diminishes organizational effectiveness and makes everyone around us miserable. I’m talking about behavior that actually hurts your career. So even if you’re a selfish, narcissistic SOB — like me — you need to pay attention to these 10 workplace rules of engagement.


Note: This article originally appeared as an entry in BNET’s The Corner Office blog. It’s also available as a PDF download.


1: Instead of covering your ass, put your ass on line


Nobody ever advanced their career by covering their ass, and nobody ever got ahead without taking risks. No pain, no gain. Simple as that.


2: Don’t rip off ideas — riff on them


Instead of co-opting or outright stealing a coworker’s or employee’s idea, do what bloggers do: We’re always riffing on each other’s posts. Everybody benefits and some of the offshoots are better than the original.


3: Tell it straight; don’t sugarcoat or breathe your own fumes


That’s right, grow some cojones, be honest about what’s going on, and accept nothing less from others. Being a yes-man or surrounding yourself with them spells disaster for you and your organization.


4: Instead of protecting your turf, open up the playing field


The more you try to protect your domain, the faster you’ll lose it. Also, turf wars quickly deteriorate into dysfunctional silo behavior and bunker mentality. It’s all bad. Besides, influence without authority or control is the true test of leadership.


5: Don’t bitch about the boss; complement his weaknesses


Workers are constantly whining about their boss without realizing the harm it does to themselves. If you want to do your career some good, learn to identify and minimize your boss’s and coworkers’ issues. That’s what good leaders and effective managers do.


6: Attack the problem, not the person


People are always complaining that conflict stresses them out. When it’s directed at a person, it is bad news. But when it’s directed at solving a real customer or product problem, that’s another story. Workplace conflict is beneficial, as long as it isn’t personal.


7: Don’t place blame; take responsibility


Pointing fingers just creates tension or inflames already tense situations. By identifying and taking responsibility for issues, you bring them to light sooner and get them resolved faster — and you will be recognized for your effort.


8: Instead of making waves, make decisions


Dysfunctional managers love to disrupt things and create turmoil. In reality, they’re only disrupting their own already-tenuous jobs. Instead of making waves, dive in, analyze the problem, and propose a solution.


9: To break analysis paralysis, take a chill pill


One or two chronic debaters can effectively stall any kind of decision-making. I’ve seen entire organizations brought down by this insidious behavior. Instead of beating a dead horse, chill out, then meet back and actually make and document a decision. You can always change it later, but not if you never make the call.


10: Replace strategy du jour with strategic planning


The opposite problem of analysis paralysis is overreacting to a single data point and declaring a new direction, oftentimes without key stakeholders present. An effective strategic planning process will take care of that.


Other rules…


Okay, just try to tell me and all your fellow readers that you’ve never ever engaged in a single one of the dysfunctional behaviors that these rules are designed to minimize. Go ahead; but you know we won’t believe you.


In any case, those are my 10 but I can probably come up with more. Any suggestions for new rules to improve the dysfunctional workplace?





"

A simple rsync script to back up your home directory

A simple rsync script to back up your home directory: "

Backing up important data is obviously something we should all do. Unfortunately, it is not always easy to make it happen. We get lazy; we do not have the additional hardware for a backup server; it takes a long time and a lot of CDs to back up to optical media; we do not trust online backup services; backup schemes are difficult to set up and use — any of dozens of reasons can stand in our way. Still, we know we should be backing up our important data.


Modern open source Unix-like operating systems offer a plethora of options for incredibly simple, effective backup schemes, however. If the problem is figuring out how to set one up, a simple rsync solution may be exactly what you need.


The rsync utility is used to synchronize files between two systems. It does so by way of incremental copies, only copying from the source to the destination what has not already been copied there, saving time, network bandwidth, and system resources. This makes it well suited to the task of maintaining up to date backups of large collections of data, on whatever schedule suits the user. It also offers the benefit of using the SSH protocol by default to encrypt the file transfer, protecting your data from eavesdroppers as it is copied across the network.


The home directory on a Unix-like system can vary in the importance of what it stores, of course. It depends on the computer use habits of the individual. Some may have nothing of particular interest there, effectively using the home directory only as a place to store configuration files for the applications they use, generated automatically when those applications are installed. Others may store hundreds of gigabytes of family photos, videos, or music. Still others, likely the most technically proficient, may have customized configuration settings, archives of source code, useful scripts that automate common tasks. Then, of course, there is the case of writers, who may have huge archives of stories, articles, documentation, and correspondence that they have created and exchanged with others.


The combination of the importance of what the person wishes to keep stored and accessible, its “irreplaceability,” its extent (that is, the storage “size” of it), and its variability over time adds up to a set of conditions that a backup scheme should satisfy. Where none of these criteria particularly exist, as in the case of the person whose entire computing life revolves around the Web browser without any bookmarked URLs that are of any particular import, it is possible that no backups are needed at all — but such a state of affairs must be rare indeed. Most people would at least suffer some consternation at the loss of browser bookmarks.


A simple script that can save you having to check the manpage every time you want to back up your home directory with rsync can reduce the process to typing a single short word. Save the following as the contents of a file:


#!/bin/sh

rsync -av --delete /home/user user@host:/home/user/backup/arch/

Command options and arguments


The a option is rsync’s “archive” option. It is actually syntactic sugar, a shortcut of sorts, that is equivalent to this much lengthier option string:


-Dgloprt


  • The D itself is syntactic sugar for two other options: --devices and --specials. The devices option preserves device files, which is probably irrelevant if you are only backing up your home directory, while the specials option preserves “special” files such as symlinks.

  • The g stands for “group”, and preserves group ownership.

  • The l option copies symlinks as symlinks, rather than as files.

  • The o stands for “owner”, and preserves user account ownership.

  • The p preserves file permissions.

  • The r stands for “recursive”, and tells rsync to read all directories within the current directory, all directories within those subdirectories, and so on.

  • The t preserves modification times.


The v option tells rsync to be verbose. Use this if you want it to output what it is doing as it does it.


This rsync command assumes you do not want to continue storing files that you have deleted, and the --delete command tells rsync to delete any files in the backup archive that have been deleted on the filesystem whose contents you wish to back up. If you want to maintain copies of files you have deleted, you can eliminate that option as a means of ensuring you have a backup of files from the last backup you made just in case you later realize you did not want to delete the file.


The first path in this rsync command, /home/user, is the path to your user account’s home directory. On BSD Unix systems, this may take the form /usr/home/user, though they typically offer a symlink so that /home works as well as /usr/home, while Linux-based systems usually only use /home. Replace the user part of that with your account’s username.


The second path tells rsync where you want to store your backup archive.



  • user is your account username on the host system where you will be storing your backups — perhaps a fileserver.

  • host is the hostname or IP address of the host system where you will be storing your backups.


The example path assumes you are storing the backup within the home directory of your user account on the target system, within a subdirectory of a directory named “backup”. Thus, the arch part of the path should be changed to whatever name you want to use to refer to the specific archive of your desktop. For instance, if you are backing up your home directory from a laptop whose hostname is “pocket”, you might want to trade arch for pocket in the example path.


A number of other options might be of some interest. Check the rsync manpage for the H, R, S, e, x, and z options, as well as the long options --exclude, --delete-after, and --delete-during for more information.


Using the script


If you name the file bupper, you can make the file executable with this command:


chmod 700 bupper

If you name it something else, substitute your filename for “bupper” in that command. Place the file in your execution path; ~/bin/ is a usually a good place for personal administrative scripts. Make sure you add that directory to your execution path in the configuration script for the shell you use at the command line. Thereafter, all you will need to do to back up your home directory to the system you are using to store your backups is enter the command bupper, or whatever else you choose to name the file. You could as easily set the rsync command with all options as a shell alias; the syntax for this will vary, depending on which shell you use — bash, csh, sh, tcsh, zsh, or any of dozens of other options.


As long as you keep this updated regularly, you should feel relatively secure about the safety of important files in case you ever need to wipe your hard drive, replace it because of a head crash, or otherwise recover from some mishap or emergency that results in loss of data.


One reason to use a script instead of an alias is flexibility. A script is easier to utilize in scheduled operations, as in the case of a cronjob that executes your bupper command once a day.


Even with a scheduled job, you may want to execute the backup script by issuing the bupper command at the shell from time to time. Cases where this might be advisable include instances of having just made some change to what you have stored on your computer that is too important to wait several hours to back up, wanting to make sure everything is up to date just before making major changes to the system, and anticipating some risk to the system you are backing up such as electrical storms or taking a laptop out of your network on a trip.





"