|
Each contribution is licensed to you under a License Agreement by its owner, not Microsoft. Microsoft does not guarantee the contribution or purport to grant rights to it.
|
Categories |
Generate Per User CAL usage trend for Wndows Server 2003(Microsoft)
Script Code
VBScript
'-------------------------------------------------------------------------------------------------------------
' This script can be used by the administrator to call the Per User CAL Report Script (PerUserCALReport.vbs) repeatedly over a period of time.
'
' Usage : cscript PerUserCALReportScheduler.vbs <NumOfCall> <Interval> [DomainFQDN1] [DomainFQDN2] [DomainFQDN3] ...
'
' where NumOfCall is the number of times the PerUserCALReportScheduler.vbs invokes CAL Report script (PerUserCALReport.vbs).
'
' Interval is the time interval in seconds between two successive calls of the CAL Report script (PerUserCALReport.vbs).
'
' DomainFQDN is the Fully Qualified Domain Name of all the domains for which the administrator wants to generate the CAL usage report.
' DomainFQDN needs to be in the format of cotoso.corp.com. If no parameter is specified, it assumes current domain.
'
' The script assumes that PerUserCALReport.vbs script is present in the same directory from which this script is being executed.
'--------------------------------------------------------------------------------------------------------------
SET Args = WScript.Arguments
'Checks whether the command line options are passed correctly or not
IF Args.Length < 2 THEN
Help
WSCRIPT.QUIT(1)
END IF
'Prepares the parameter string for the Per User CAL Report Script
NumOfCall = CLng(Args(0))
Interval = CLng(Args(1))
ParamList = ""
For i = 2 To (Args.Length - 1)
ParamList = ParamList & " " & Args(i)
Next
'Calls Per User CAL Report Script over a period of time
For i = 0 To (NumOfCall - 1)
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "cscript PerUserCALReport.vbs /W2K3" & ParamList
On Error Resume Next
Set objShell = Nothing
IF i < (NumOfCall - 1) THEN
WScript.Sleep(Interval * 1000)
END IF
Next
WSCRIPT.QUIT(0)
SUB Help()
HelpMesg = "Usage : cscript PerUserCALReportScheduler.vbs <NumOfCall> <Interval> [DomainFQDN1] [DomainFQDN2] [DomainFQDN3] ..." & vbNewLine & _
"" & vbNewLine & _
"where NumOfCall is the number of times the PerUserCALReportScheduler.vbs invokes CAL Report script" & vbNewLine & _
"Interval is the time interval in seconds between two successive calls of the CAL Report script" & vbNewLine & _
"DomainFQDN is the Fully Qualified Domain Name of all the domains for which the administrator wants to generate the CAL usage report." & vbNewLine & _
"" & vbNewLine & _
"DomainFQDN needs to be in the format of cotoso.corp.com. If no parameter is specified, it assumes current domain."
WSCRIPT.ECHO "" & HelpMesg
END SUB
Platforms
For online peer support, join
The Official Scripting Guys Forum!
To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script.
Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
Be the first to create a discussion.
|