Thursday, June 23, 2011

Screenshot vs Directory Listing

It really frustrates me that most people insist on giving me a screen grab when I asked for a directory listing, even worse is that it ends up being a distorted shrunk jpg of everything they had open at the time. So I decided to wright this post to address both of those issues.

Screen Capture
You can take a picture of what is on your screen by pressing PRINT SCREEN (PRTSC or PRTSCN on some keyboards). This is called a screen capture. You can then paste the screen capture into a document, e‑mail message, or other file. - Microsoft Windows

There are two types of screen captures you can take:
1.      To copy the entire screen
o   Press the 'PRINT SCREEN' button.

2.      To copy only an active window
o   Press both 'ALT' & 'PRINT SCREEN'.
Note: An active window is the currently focused window.


Directory Listing
Displays a list of a directory's files and subdirectories. Used without parameters, dir displays the disk's volume label and serial number, followed by a list of directories and files on the disk, including their names and the date and time each was last modified.
For files, dir displays the name extension and the size in bytes. Dir also displays the total number of files and directories listed, their cumulative size, and the free space (in bytes) remaining on the disk.

Syntax:
dir[Drive:][Path][FileName][...][/p][/q][/w][/d]
[/a[[:]attributes]]
[/o[[:]SortOrder]]
[/t[[:]TimeField]][/s][/b][/l][/n][/x][/c [/4]
Now this may look overwhelming, but what we need to achieve is not nearly as complex.
  1. Brows to the folder in question.
  2. Create a new text file.
  3. Add the following text "dir *.* > filename.txt" to the file just created.
  4. Save it, Close it & then change the files extension from '.txt' to '.bat'.
  5. Run the bat file.
This will output a text file called filename.txt that contains all the folder information and content.

Output example :
 C:\Users\Public\Pictures\Sample Pictures>'''dir'''
  Volume in drive C is System
  Volume Serial Number is C8D0-76E2
 
  Directory of C:\Users\Public\Pictures\Sample Pictures
 
 14-07-2009  06:41    <DIR>          .
 14-07-2009  06:41    <DIR>          ..
 14-07-2009  06:52           879,394 Chrysanthemum.jpg
 14-07-2009  06:52           845,941 Desert.jpg
 14-07-2009  06:52           595,284 Hydrangeas.jpg
 14-07-2009  06:52           775,702 Jellyfish.jpg
 14-07-2009  06:52           780,831 Koala.jpg
 14-07-2009  06:52           561,276 Lighthouse.jpg
 14-07-2009  06:52           777,835 Penguins.jpg
 14-07-2009  06:52           620,888 Tulips.jpg
                8 File(s)      5,837,151 bytes
                2 Dir(s)  57,925,980,160 bytes free
 
 C:\Users\Public\Pictures\Sample Pictures>'''dir /w'''
  Volume in drive C is System
  Volume Serial Number is C8D0-76E2
 
  Directory of C:\Users\Public\Pictures\Sample Pictures
 
 [.]                 [..]                Chrysanthemum.jpg   Desert.jpg          Hydrangeas.jpg      Jellyfish.jpg
 Koala.jpg           Lighthouse.jpg      Penguins.jpg        Tulips.jpg
                8 File(s)      5,837,151 bytes
                2 Dir(s)  57,925,992,448 bytes free
 
 C:\Users\Public\Pictures\Sample Pictures>
PS. This can obviously be refind using parameters :
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx?mfr=true

Tuesday, January 18, 2011

Basic STSADM Commands

Working with SharePoint on a daily basis you'll need to have some basic STSADM knowledge, the following post will hopefully provide you with the basics you need to get started.

Physical location:
The 'stsadm.exe' executable resides in the 12 hive bin folder, the hive can be found under:
"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\"

Usage:
stsadm.exe -o  []
stsadm.exe -help []
1) Open Command Prompt (Run as administrator)
2) Change directory to hive \BIN folder


Here's some basic stsadm commands examples:

Add the solution
stsadm -o addsolution
-filename 

Deploy the solution
stsadm -o deploysolution
-name  
[-url ] 
[-immediate] 
[-allowgacdeployment] 
[-force]

Install the feature
stsadm -o installfeature 
{-filename  
|| 
-name }
[-force]

Activate the feature
stsadm -o activatefeature 
{-filename 
|| 
-name  
|| 
-id } 
[-url ] 
[-force]


Deactive the feature
stsadm -o deactivatefeature 
{-filename  
|| 
-name  
|| 
-id } 
[-url ] 
[-force]

Uninstall the feature
stsadm -o uninstallfeature 
{-filename  
|| 
-name  
|| 
-id } 
[-force]

Retract Solution
stsadm -o retractsolution 
-name  
[-url ] 
[-immediate]

Delete Solution
stsadm -o deletesolution 
-name  
[-override]

Note: The full list of all commands can be foud using 'stsadm -help'

Update (2012-07-07):
SP2010 hive is 14 not 12 …\Microsoft Shared\Web Server Extensions\14\…
Use PowerShell / (SharePoint 2010 Management Shell) to achieve the same things as via ‘stsadm’ and lots lots more! ;)