Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to recreate shares

Status
Not open for further replies.

JadeKnight

IS-IT--Management
Feb 23, 2004
94
NO
Maybe usefull to someone...

Code:
'***************************************************************************************************************************
'						ShareJuggler.vbs Ver. 1.0
'***************************************************************************************************************************
'Copyright (C) 2006 Nils-Erik Auråker, nils-erik.auraaker@toetip.com
'
'This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
'as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 
'
'This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
'of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 
'
'You should have received a copy of the GNU General Public License along with this program; if not, write to the
'Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'---------------------------------------------------------------------------------------------------------------------------

'********
'Abstract
'********
'Uses WMI to : 
'- Read share information from a server and write it to a file
'- Create share based upon information from file

'Script is an ideal tool when you want to recreate share on one a new server after move/restore of data. The script DOES NOT
'preserve share permissions. All shares created from file will have sharepermission : Everyone Full Controll. This is hovewer
'"best practise", proper permissions should be set through ntfs.

'*****************
'Real life example
'*****************
'Scenario :
'You are worried about you're old Windows 2000 fileserver, or even worse you're NT 4.0 fileserver. Moving data to another
'server can trigger a lot of work due to the fact that you have multiple homeshares on the server. All data is located
'under volume E:\.
'Possible solution : 
'Install the latest Windows Server available, copy data from old to new fileserver. Be sure to include ntfs permission.
'Run "cscript sharejuggler /d:MyShares.txt" on the old server, and copy the file MyShares.txt to the new server.
'If the data is located on another volume than e:\ (on the new server, let's say d:\), open up you're favorite text editor
'and replace all occurences of e:\ with d:\.
'Run "cscript sharejuggler /c:MyShares.txt" on the new server. All shares wich existed on the old server will now be
'created on the new server.
'If you have a lot of UNC bindings to the old server. Shut it down. Rename the new server to the name of the old one.
'If you're using a domain, make sure the new server is member of the domain. Then reeboot the server.
'Home free... ;)

'******
'Syntax
'******
'Type "cscript ShareJuggler.vbs /?" for syntax


'************
'Requirements
'************
'Windows Script Host 5.6 or above
'Script must be executed in system or admin context

'****************
'Supported System 
'****************
'Windows NT 6.0 Sp4 or higher
'Windows 2000
'Windows 2003
'Windows XP

'Tested on Windows 2003

Option Explicit

'***************************************************************************************************************************
'							DO NOT CHANGE CONSTANT
'***************************************************************************************************************************
Const FORREADING	= 1
Const FORWRITING	= 2
Const FORAPPENDING	= 8
Const SUCCESS           = 0
Const ERRORL            = 1
Const WARNING           = 2
Const INFORMATION       = 4
Const ABORT		= "ShareJuggler.vbs aborted with error(s). To determine cause, see logged information"
Const APPNAME		= "ShareJuggler"
Const APPVER		= "1.0"
Const COPYYEAR		= "2006"
Const AUTHOR		= "Nils-Erik Auråker"
'***************************************************************************************************************************


Dim aExclude,aNamedarg
Dim bC,bD
Dim i,iError
Dim oShell,oFso,oFile,oWMI,oShare
Dim sArg,sFile,sError

'Create Shell object
Set oShell = Wscript.CreateObject("Wscript.Shell")

'Check if script is invoked by cscript engine, force if not
s_ForceUseCScript

'Create FileSystemObject
Set oFso = CreateObject("Scripting.FileSystemObject")

'Count arguments, display syntax/quit if wrong
If wscript.arguments.named.count < 1 Then
	Call s_ShowSyntax()
End If

'Bind to arguments
Set aNamedarg = Wscript.Arguments.Named

'Parse arguments in array
For each sArg in aNamedArg
	s_ParseArg sArg, aNamedArg(sArg)
Next

'Set default share exclude list if not provided as option
If IsArray(aExclude) = False Then
	aExclude = Array("admin$","c$","d$","e$","f$","g$","h$","i$","ipc$","j$","k$","l$","m$","n$","netlogon"_
	,"o$","p$","q$","r$","s$","sysvol","t$","u$","v$","w$","x$","y$","z$")
End If

'Connetc to WMI Service
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

If bC = True Then 
	If Not (oFso.FileExists(sFile)) Then
		s_CustomError(3)
	End If
	s_CreateShare(sFile)
End If

If bD = True Then
	If (oFso.FileExists(sFile)) Then
		s_CustomError(2)
	End If
	s_DumpShare(sFile)
End If



Set oShell = Nothing
Set oFso = Nothing
Set aNamedarg = Nothing


'***************************************************************************************************************************
'							SUB
'***************************************************************************************************************************

Sub s_CreateShare(s)
'********************************************************
' Purpose : Create share based upon information from file
' Input   : s : Filename (full path) (string)
'********************************************************

'Dim oShare
Dim aShare
Dim sLine
Dim iErr

	'On Error Resume Next
	
	Set oFile = oFso.OpenTextFile(s, FORREADING)

	If err.number <> 0 Then
		s_Error err.number, err.description
	End If
	
	Set oShare = oWMI.Get("Win32_Share")
	
	Do Until oFile.AtEndOfStream = True
		
		sLine = oFile.ReadLine
		
		
		If Not Left(sLine, 1) = "'" Then

			ReDim aShare(5)
			aShare = Split(sLine, ",", -1, 1)
			aShare(2) = Int(aShare(2))
			If aShare(3) <> "" Then
				aShare(3) = Int(aShare(3))
				iErr = oShare.Create(aShare(0),aShare(1),aShare(2),aShare(3),aShare(4))
			Else
				iErr = oShare.Create(aShare(0),aShare(1),aShare(2),,aShare(4))
			End If
			
			Select Case iErr
				Case 0
					wscript.echo "Success - Creating share : " & aShare(1)
				Case 2
					wscript.echo "Access denied - Creating share : " & aShare(1)
				Case 8
					wscript.echo "Unknown failure - Creating share : " & aShare(1)
				Case 9
					wscript.echo "Invalid name - Creating share : " & aShare(1)
				Case 10
					wscript.echo "Invalid level - Creating share : " & aShare(1)
				Case 21
					wscript.echo "Invalid parameter - Creating share : " & aShare(1)
				Case 22
					wscript.echo "Duplicate share - Creating share : " & aShare(1)
				Case 23
					wscript.echo "Redirected path - Creating share : " & aShare(1)
				Case 24
					wscript.echo "Unknown device or directory - Creating share : " & aShare(1)
				Case 25
					wscript.echo "Net name not found - Creating share : " & aShare(1)
				Case Else
					wscript.echo "An undocumented error occured - Creating share : " & aShare(1)
			End Select
		
		End If
	Loop

End Sub

Sub s_CustomError(i)
'**********************************************************************
' Purpose : Show in-script user based errors and abort script operation
'**********************************************************************
	
	Select Case i
		Case 1 
			wscript.echo "You can not combine /C:Filepath and /D:Filepath."
		Case 2
			wscript.echo "The file specified : " & sFile & " allready exists. Please re-run script with different filename."
		Case 3
			wscript.echo "The file specified : " & sFile & " can not be opened. Please check path and re-run script."
		Case Else
			wscript.echo "This error should not have occured. This error is most likely cause by an error in script."
			wscript.echo "Please contact the author of the script and provide details on how to produce the error."
	End Select
	
	wscript.echo ABORT
	wscript.quit
			
End Sub

Sub s_DumpShare(s)
'***************************************************
' Purpose : Write existing share information to file
' Input   : s : Filename (full path) (string)
'***************************************************
'Dim oFile

Dim bSkip
Dim cShare
Dim iTotal,iSkip,iCreate
	
	On Error Resume Next
	
	Set oFile = oFso.OpenTextFile(s, FORWRITING, True)
	
	If err.number <> 0 Then
		s_Error err.number, err.description
	End If
	
	oFile.WriteLine "'Created with " & APPNAME & " " & APPVER
	oFile.WriteLine "'Lines beginning with character ' will not be processed under create session"
	oFile.WriteLine "'Format is : Path,Name,Type,MaximumAllowed,Caption"
	oFile.WriteLine "'For complete status, see buttom of this file"
	oFile.WriteLine "'"

	Set cShare = oWMI.ExecQuery("Select * from Win32_Share")
		
		iTotal = 0
		iSkip = 0
		iCreate = 0
		
		For each oShare in cShare
			
			bSkip = False
			
			For i = 0 to UBound(aExclude)
				If LCase(aExclude(i)) = LCase(oShare.Name) Then
					oFile.WriteLine "'" & oShare.Path & "," & oShare.Name & "," & oShare.Type & "," & oShare.MaximumAllowed & "," & oShare.Caption
					iSkip = iSkip + 1
					bSkip = True
					Exit For
				End If
			Next
			
			If bSkip = False Then
				oFile.WriteLine oShare.Path & "," & oShare.Name & "," & oShare.Type & "," & oShare.MaximumAllowed & "," & oShare.Caption
				iCreate = iCreate + 1
			End If
			
			iTotal = iTotal + 1
		Next

	oFile.WriteLine "'"
	oFile.WriteLine "'Total number of shares found : " & iTotal
	oFile.WriteLine "'Total number of shares to skip : " & UBound(aExclude) & " (Default skipped or provided through /E option)"
	oFile.WriteLine "'Total number of skipped shares : " & iSkip
	oFile.WriteLine "'Total number of shares to be created : " & iCreate
	
	oFile.Close
	
	Set cShare = Nothing
	Set oFile = Nothing
	
End Sub

Sub s_Error(i,s)
'*********************************************************************
' Purpose : Show errors generated by engine and abort script operation
' Input   : i : err.number (integer)
'           s : err.description (string)
'*********************************************************************
	
	wscript.echo "ERROR!"
	wscript.echo "The error code was : " & i
	wscript.echo "The error code in hex : " & Hex(i)
	wscript.echo "The error description : " & s
	wscript.quit

End Sub

Sub s_ForceUseCScript()
'********************************************
' Purpose: Force script to use cscript engine
'********************************************
	If Not WScript.FullName = WScript.Path & "\cscript.exe" Then
		oShell.Popup "Script is not invoked uder cscript engine. Relaunching under cscript...",5,"WSCRIPT"
		oShell.Run "cmd.exe /k " & WScript.Path & "\cscript.exe //NOLOGO " & Chr(34) & WScript.scriptFullName & Chr(34),1,False
		WScript.Quit 0
	End If
End Sub

Sub s_ShowSyntax()
'*******************************
' Purpose: Show syntax of script
'*******************************
	wscript.echo "Cscript " & APPNAME & ".vbs [[/C:Filepath]|[/D:Filepath]] [/Options]" & VbNewLine
	
	wscript.echo "/C:Filename.txt       Create share(s) from file. Use full path to file."
	wscript.echo "/D:Filename.txt       Dump existing share(s) to file. Use full path to file."
	wscript.echo "/E:Share1,Share2      Exclude Option. Use , as delimiter to seperate shares."
	wscript.echo "                      Default are following excluded : C$-Z$,IPC$,ADMIN$"
	wscript.echo "                      NETLOGON and SYSVOL"
	wscript.echo "/License              Show License"
	wscript.echo "/? or /Help           Show help"
	wscript.echo "/Copyright            Show CopyRight"
	wscript.quit

End Sub

Sub s_ShowCopyRight()
'************************
' Purpose: Show CopyRight
'************************
	wscript.echo APPNAME & " Ver." & APPVER & " , Copyright (C) " & COPYYEAR & " " & AUTHOR & "." & vbNewLine & vbNewLine &_
		     APPNAME & " Ver." & APPVER & " comes with ABSOLUTELY NO WARRANTY;" & vbNewLine &_
		     "This is free software, and you are welcome to redistribute it under certain" & vbNewLine &_
		     "conditions; type " & APPNAME & ".vbs /License for details." & vbNewLine

End Sub

Sub s_ShowLicense()
'*************************
' Purpose: Show GNU Licens
'*************************
	wscript.echo vbNewLine & vbNewLine
	wscript.echo "TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION" & vbNewLine
	
	wscript.echo "0. This License applies to any program or other work which contains a notice" & vbNewLine &_
	             "placed by the copyright holder saying it may be distributed under the terms of" & vbNewLine &_
	             "this General Public License. The " & Chr(34) & "Program" & Chr(34) & ", below, refers to any such program" & vbNewLine &_
	             "or work, and a " & Chr(34) & "work based on the Program" & Chr(34) & " means either the Program or any" & vbNewLine &_
	             "derivative work under copyright law: that is to say, a work containing the" & vbNewLine &_
	             "Program or a portion of it, either verbatim or with modifications and/or" & vbNewLine &_
	             "translated into another language. (Hereinafter, translation is included without" & vbNewLine &_
	             "limitation in the term " & Chr(34) & "modification" & Chr(34) & ".) Each licensee is addressed as " & Chr(34) & "you" & Chr(34) & "." & vbNewLine
	
	wscript.echo "Activities other than copying, distribution and modification are not covered by" & vbNewLine &_ 
	             "this License; they are outside its scope. The act of running the Program is not" & vbNewLine &_
	             "restricted, and the output from the Program is covered only if its contents" & vbNewLine &_
	             "constitute a work based on the Program (independent of having been made by" & vbNewLine &_
	             "running the Program). Whether that is true depends on what the Program does." & vbNewLine & vbNewLine
	
	wscript.echo "1. You may copy and distribute verbatim copies of the Program's source code" & vbNewLine &_
	             "as you receive it, in any medium, provided that you conspicuously and" & vbNewLine &_
	             "appropriately publish on each copy an appropriate copyright notice and" & vbNewLine &_
	             "disclaimer of warranty; keep intact all the notices that refer to this License" & vbNewLine &_
	             "and to the absence of any warranty; and give any other recipients of the" & vbNewLine &_
	             "Program a copy of this License along with the Program." & vbNewLine
	
	wscript.echo "You may charge a fee for the physical act of transferring a copy, and you may" & vbNewLine &_
	             "at your option offer warranty protection in exchange for a fee." & vbNewLine & vbNewLine
	
	wscript.echo "2. You may modify your copy or copies of the Program or any portion of it, thus" & vbNewLine &_
	             "forming a work based on the Program, and copy and distribute such modifications" & vbNewLine &_
	             "or work under the terms of Section 1 above, provided that you also meet all of" & vbNewLine &_
	             "these conditions:" & vbNewLine
	
	wscript.echo "a) You must cause the modified files to carry prominent notices stating that" & vbNewLine &_
	             "you changed the files and the date of any change." & vbNewLine
	
	wscript.echo "b) You must cause any work that you distribute or publish, that in whole or" & vbNewLine &_
	             "in part contains or is derived from the Program or any part thereof, to be" & vbNewLine &_
	             "licensed as a whole at no charge to all third parties under the terms of this" & vbNewLine &_
	             " License." & vbNewLine
	
	wscript.echo "c) If the modified program normally reads commands interactively when run, you" & vbNewLine &_
	             "must cause it, when started running for such interactive use in the most" & vbNewLine &_
	             "ordinary way, to print or display an announcement including an appropriate" & vbNewLine &_
	             "copyright notice and a notice that there is no warranty (or else, saying that" & vbNewLine &_
	             "you provide a warranty) and that users may redistribute the program under these" & vbNewLine &_
	             "conditions, and telling the user how to view a copy of this License. (Exception" & vbNewLine &_
	             ": if the Program itself is interactive but does not normally print such an" & vbNewLine &_
	             "announcement, your work based on the Program is not required to print an" & vbNewLine &_
	             "announcement.)" & vbNewLine
	
	wscript.echo "These requirements apply to the modified work as a whole. If identifiable" & vbNewLine &_
	             "sections of that work are not derived from the Program, and can be reasonably" & vbNewLine &_
	             "considered independent and separate works in themselves, then this License," & vbNewLine &_
	             "and its terms, do not apply to those sections when you distribute them as" & vbNewLine &_
	             "separate works. But when you distribute the same sections as part of a whole" & vbNewLine &_
	             "which is a work based on the Program, the distribution of the whole must be" & vbNewLine &_
	             "on the terms of this License, whose permissions for other licensees extend" & vbNewLine &_
	             "to the entire whole, and thus to each and every part regardless of who wrote" & vbNewLine &_
	             "it." & vbNewLine
	
	wscript.echo "Thus, it is not the intent of this section to claim rights or contest your" & vbNewLine &_
	             "rights to work written entirely by you; rather, the intent is to exercise the" & vbNewLine &_
	             "right to control the distribution of derivative or collective works based on" & vbNewLine &_
	             "the Program." & vbNewLine
	
	wscript.echo "In addition, mere aggregation of another work not based on the Program with" & vbNewLine &_
	             "the Program (or with a work based on the Program) on a volume of a storage" & vbNewLine &_
	             "or distribution medium does not bring the other work under the scope of this" & vbNewLine &_
	             "License." & vbNewLine
	
	wscript.echo "3. You may copy and distribute the Program (or a work based on it, under" & vbNewLine &_
	             "Section 2) in object code or executable form under the terms of Sections 1 and" & vbNewLine &_
	             "2 above provided that you also do one of the following:" & vbNewLine
	
	wscript.echo "a) Accompany it with the complete corresponding machine-readable source code," & vbNewLine &_
	             "which must be distributed under the terms of Sections 1 and 2 above on a medium" & vbNewLine &_
	             "customarily used for software interchange; or," & vbNewLine
	
	wscript.echo "b) Accompany it with a written offer, valid for at least three years, to give" & vbNewLine &_
	             "any third party, for a charge no more than your cost of physically performing" & vbNewLine &_
	             "source distribution, a complete machine-readable copy of the corresponding" & vbNewLine &_
	             "source code, to be distributed under the terms of Sections 1 and 2 above on a" & vbNewLine &_
	             "medium customarily used for software interchange; or," & vbNewLine
	
	wscript.echo "c) Accompany it with the information you received as to the offer to distribute" & vbNewLine &_
	             "corresponding source code. (This alternative is allowed only for noncommercial" & vbNewLine &_
	             "distribution and only if you received the program in object code or executable" & vbNewLine &_
	             "form with such an offer, in accord with Subsection b above.)" & vbNewLine
	
	wscript.echo "The source code for a work means the preferred form of the work for making" & vbNewLine &_
	             "modifications to it. For an executable work, complete source code means all the" & vbNewLine &_
	             "source code for all modules it contains, plus any associated interface" & vbNewLine &_
	             "definition files, plus the scripts used to control compilation and installation" & vbNewLine &_
	             "of the executable. However, as a special exception, the source code distributed" & vbNewLine &_
	             "need not include anything that is normally distributed (in either source or" & vbNewLine &_
	             "binary form) with the major components (compiler, kernel, and so on) of the" & vbNewLine &_
	             "operating system on which the executable runs, unless that component itself" & vbNewLine &_
	             "accompanies the executable." & vbNewLine
	
	wscript.echo "If distribution of executable or object code is made by offering access to copy" & vbNewLine &_
	             "from a designated place, then offering equivalent access to copy the source" & vbNewLine &_
	             "code from the same place counts as distribution of the source code, even though" & vbNewLine &_
	             "third parties are not compelled to copy the source along with the object code." & vbNewLine
	
	wscript.echo "4. You may not copy, modify, sublicense, or distribute the Program except as" & vbNewLine &_
	             "expressly provided under this License. Any attempt otherwise to copy, modify," & vbNewLine &_
	             "sublicense or distribute the Program is void, and will automatically terminate" & vbNewLine &_
	             "your rights under this License. However, parties who have received copies, or" & vbNewLine &_
	             "rights, from you under this License will not have their licenses terminated so" & vbNewLine &_
	             "long as such parties remain in full compliance." & vbNewLine
	
	wscript.echo "5. You are not required to accept this License, since you have not signed it." & vbNewLine &_
	             "However, nothing else grants you permission to modify or distribute the Program" & vbNewLine &_
	             "or its derivative works. These actions are prohibited by law if you do not" & vbNewLine &_
	             "accept this License. Therefore, by modifying or distributing the Program (or" & vbNewLine &_
	             "any work based on the Program), you indicate your acceptance of this License to" & vbNewLine &_
	             " do so, and all its terms and conditions for copying, distributing or modifying" & vbNewLine &_
	             "the Program or works based on it." & vbNewLine
	
	wscript.echo "6. Each time you redistribute the Program (or any work based on the Program)," & vbNewLine &_
	             "the recipient automatically receives a license from the original licensor to" & vbNewLine &_
	             "copy, distribute or modify the Program subject to these terms and conditions." & vbNewLine &_
	             "You may not impose any further restrictions on the recipients' exercise of the" & vbNewLine &_
	             "rights granted herein. You are not responsible for enforcing compliance by" & vbNewLine &_
	             "third parties to this License." & vbNewLine
	
	wscript.echo "7. If, as a consequence of a court judgment or allegation of patent" & vbNewLine &_
	             "infringement or for any other reason (not limited to patent issues), conditions" & vbNewLine &_
	             "are imposed on you (whether by court order, agreement or otherwise) that" & vbNewLine &_
	             "contradict the conditions of this License, they do not excuse you from the" & vbNewLine &_
	             "conditions of this License. If you cannot distribute so as to satisfy" & vbNewLine &_
	             "simultaneously your obligations under this License and any other pertinent" & vbNewLine &_
	             "obligations, then as a consequence you may not distribute the Program at all." & vbNewLine &_
	             "For example, if a patent license would not permit royalty-free redistribution" & vbNewLine &_
	             "of the Program by all those who receive copies directly or indirectly through" & vbNewLine &_
	             "you, then the only way you could satisfy both it and this License would be to" & vbNewLine &_
	             "refrain entirely from distribution of the Program." & vbNewLine
	
	wscript.echo "If any portion of this section is held invalid or unenforceable under any" & vbNewLine &_
	             "particular circumstance, the balance of the section is intended to apply and" & vbNewLine &_
	             "the section as a whole is intended to apply in other circumstances." & vbNewLine
	
	wscript.echo "It is not the purpose of this section to induce you to infringe any patents or" & vbNewLine &_
	             "other property right claims or to contest validity of any such claims; this" & vbNewLine &_
	             "section has the sole purpose of protecting the integrity of the free software" & vbNewLine &_
	             "distribution system, which is implemented by public license practices. Many" & vbNewLine &_
	             "people have made generous contributions to the wide range of software" & vbNewLine &_
	             "distributed through that system in reliance on consistent application of that" & vbNewLine &_
	             "system; it is up to the author/donor to decide if he or she is willing to" & vbNewLine &_
	             "distribute software through any other system and a licensee cannot impose that" & vbNewLine &_
	             "choice." & vbNewLine
	
	wscript.echo "This section is intended to make thoroughly clear what is believed to be a" & vbNewLine &_
	             "consequence of the rest of this License." & vbNewLine
	
	wscript.echo "8. If the distribution and/or use of the Program is restricted in certain" & vbNewLine &_
	             "countries either by patents or by copyrighted interfaces, the original" & vbNewLine &_
	             "copyright holder who places the Program under this License may add an explicit" & vbNewLine &_
	             "geographical distribution limitation excluding those countries, so that" & vbNewLine &_
	             "distribution is permitted only in or among countries not thus excluded. In such" & vbNewLine &_
	             "case, this License incorporates the limitation as if written in the body of" & vbNewLine &_
	             "this License." & vbNewLine
	
	wscript.echo "9. The Free Software Foundation may publish revised and/or new versions of the" & vbNewLine &_
	             "General Public License from time to time. Such new versions will be similar in" & vbNewLine &_
	             "spirit to the present version, but may differ in detail to address new" & vbNewLine &_
	             "problems or concerns." & vbNewLine
	
	wscript.echo "Each version is given a distinguishing version number. If the Program specifies" & vbNewLine &_
	             "a version number of this License which applies to it and " & Chr(34) & "any later version" & Chr(34) & "," & vbNewLine &_
	             "you have the option of following the terms and conditions either of that" & vbNewLine &_
	             "version or of any later version published by the Free Software Foundation. If" & vbNewLine &_
	             "the Program does not specify a version number of this License, you may choose" & vbNewLine &_
	             "any version ever published by the Free Software Foundation." & vbNewLine
	
	wscript.echo "10. If you wish to incorporate parts of the Program into other free programs" & vbNewLine &_
	             "whose distribution conditions are different, write to the author to ask for" & vbNewLine &_
	             "permission. For software which is copyrighted by the Free Software Foundation," & vbNewLine &_
	             "write to the Free Software Foundation; we sometimes make exceptions for this." & vbNewLine &_
	             "Our decision will be guided by the two goals of preserving the free status of" & vbNewLine &_
	             "all derivatives of our free software and of promoting the sharing and reuse of" & vbNewLine &_
	             "software generally." & vbNewLine
	
	wscript.echo "NO WARRANTY" & vbNewLine
	
	wscript.echo "11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR" & vbNewLine &_
	             "THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE" & vbNewLine &_
	             "STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE" & vbNewLine &_
	             "PROGRAM " & Chr(34) & "AS IS" & Chr(34) & " WITHOUT WARRANTY OF ANY KIND, EITHER" & vbNewLine &_
	             "EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF" & vbNewLine &_
	             "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE" & vbNewLine &_
	             "QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE" & vbNewLine &_
	             "DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION." & vbNewLine
	
	wscript.echo "12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL" & vbNewLine &_
	             "ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE" & vbNewLine &_
	             "PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY" & vbNewLine &_
	             "GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR" & vbNewLine &_
	             "INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA" & vbNewLine &_
	             "BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A" & vbNewLine &_
	             "FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER" & vbNewLine &_
	             "OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES." & vbNewLine
	
	wscript.echo "END OF TERMS AND CONDITIONS"
	
	wscript.quit

End Sub

Sub s_ParseArg(sArg, s)
'*******************************************************
' Purpose : Parse arguments passed from aNamedArg array.
' Input   : sArg : Name of argument, String
'           s : Value of argument, String
'*******************************************************
	sArg = UCase(sArg)
	
	Select Case sArg
		Case "C"
			If sFile = "" Then
				sFile = s
				bC = True
			Else
				s_CustomError(1)
			End If
		Case "D"
			If sFile = "" Then
				sFile = s
				bD = True
			Else
				s_CustomError(1)
			End If
		Case "E"
			aExclude = Split(s, ",", -1, 1)

		Case "LICENSE"
			s_ShowLicense
		Case "?"
			s_ShowSyntax
		Case "HELP"
			s_ShowSyntax
		Case "COPYRIGHT"
			s_ShowCopyright
		Case Else
			s_ShowSyntax
	End Select
	
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top