Page 2 of 3 <123>
Topic Options
#172685 - 2007-01-11 01:59 PM Re: Mail the Software Inventory [Re: Phoenix1987]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
You could put a check in the script to see if the file already exists. You can put this code below the line where $file is filled with the filename.

Code:
If Exist($file)
	Exit
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#172700 - 2007-01-11 08:41 PM Re: Mail the Software Inventory [Re: Mart]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Actually while Mart has the correct answer, you will need to replace this section
Code:
If Exist($File)
  Del $File
EndIf
with what he supplied.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#172724 - 2007-01-12 02:46 PM Re: Mail the Software Inventory [Re: NTDOC]
BarryWhite Offline
Fresh Scripter

Registered: 2005-10-24
Posts: 35
Loc: UK
NTDOC,
Great user & hardware inventory script, is it possible to run this against either a txt file of computer names or even better would be an ip subnet. Then place all info in subsequent rows.

Top
#172738 - 2007-01-12 08:36 PM Re: Mail the Software Inventory [Re: BarryWhite]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Is it possible ? Yes - Will I write the code to do it ? Maybe someday but not right now. Sorry just been too busy with other projects to spend the time on a real update that this needs to be generic enough for everyone to use.

If you're okay at scripting though the changes you need to make for yourself are not all that difficult though and you could make them and post back your suggestions for others.

In the future as I have time I will try to get back to this and update it per some requests.

.

Top
#172788 - 2007-01-15 04:28 PM Re: Mail the Software Inventory [Re: Gargoyle]
Phoenix1987 Offline
Fresh Scripter

Registered: 2007-01-02
Posts: 49
Loc: Rotterdam, Netherlands
Originally Posted By: Gargoyle
Actually while Mart has the correct answer, you will need to replace this section
Code:
If Exist($File)
  Del $File
EndIf
with what he supplied.


sorry but still my entire script end. I just want this function to stop.
_________________________
A mistake is Human, But to make it a real mess you need a computer.

Top
#172793 - 2007-01-15 06:48 PM Re: Mail the Software Inventory [Re: Phoenix1987]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Post your modifications up to this point (the whole script please). At this point so many suggestions have been made, we need to see exactly where you are.

Also let us know exactly what the script is doing and at what point.

If you are unsure of what is going on or causing the exit, on the command line add the parameter '/d' (no quotes), and this will allow you to step through the script and see what it is doing along the way.

See these manual pages for more information -
[Running KiXtart] http://www.kixtart.org/manual/Notes/RUNNING.htm
[Debug How To] http://www.kixtart.org/manual/Commands/Debug.htm
_________________________
Today is the tomorrow you worried about yesterday.

Top
#172802 - 2007-01-16 01:34 AM Re: Mail the Software Inventory [Re: Gargoyle]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
better still, put:
debug 'on'
in the code near where you know it is falling down.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#172814 - 2007-01-16 09:11 AM Re: Mail the Software Inventory [Re: Les]
Phoenix1987 Offline
Fresh Scripter

Registered: 2007-01-02
Posts: 49
Loc: Rotterdam, Netherlands
This is what i have.

Code:
If Not @LOGONMODE
	     Break On
EndIf

;BREAK OFF
Color w/b
Box(0,0,50,80,FULL)

At	(5,10)  "U wordt aangemeld bij De Jager Advies & Ontwerp"
At	(7,10)  "Even geduld aub...."
Color r+/n

Color w/b

Color w+/n
At ( 9,10) "Username : " ; display some text strings
At (10,10) "Full name : "
At (11,10) "Privilege : "
At (12,10) "Computername : "
At (13,10) "Domain : "
At (14,10) "Logon Server : "
At (15,10) "Operating System : "
;
Color y+/n
At ( 9,45) @userid ; ...and some macro's
At (10,45) @fullname
At (11,45) @priv
At (12,45) @wksta
At (13,45) @domain
At (14,45) @lserver
At (15,45) @ProductType

;
Sleep 1
;
Color w/b
;
SetTime @LSERVER

;..........................................................................Software script
Break On
Dim $SO,$Software,$Application,$x,$File,$Send,$Excel,$Report
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')
 
$Excel = ReadValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Excel.exe','')
$File = '%TEMP%\' + @USERID + '_' + @WKSTA + '.XLS'
If Exist($File)
  Exit
EndIf
$Software = QS(Split(GetSoftwareInfo(),@CRLF))
ImportToXLS($Software,$File)
Copy $file "\\fileprintserver\groep\systeembeheer\software overzicht"
 
Function ImportToXLS($List,$Output)
 Dim $Excel, $Workbook, $Row, $App, $, $Error
 If VarType($List) <> 8204 ; Not a string array 
  Exit 1 ; ERROR_INVALID_FUNCTION  
 EndIf
 $Excel = CreateObject("Excel.Application")
 If $Excel
  $Excel.DisplayAlerts = 0
  $Workbook = $Excel.Workbooks.Add(-4167)
  If $Workbook
   $Workbook.ActiveSheet.Rows(1).Columns(1).Value = "Application"
   $Workbook.ActiveSheet.Rows(1).Columns(1).Interior.Color = &EED2BD
   $Workbook.ActiveSheet.Rows(1).Columns(1).Font.Bold = -1
   $Workbook.ActiveSheet.Rows(1).RowHeight = 25
   $Workbook.ActiveSheet.Rows(1).VerticalAlignment = 2
   $Workbook.ActiveSheet.Rows(1).HorizontalAlignment = -4131
   $Workbook.ActiveSheet.Rows(1).Columns(2).Value = "Path"
   $Workbook.ActiveSheet.Rows(1).Columns(2).Interior.Color = &EED2BD
   $Workbook.ActiveSheet.Rows(1).Columns(2).Font.Bold = -1
   $Workbook.ActiveSheet.Rows(1).Columns(3).Value = "Version"
   $Workbook.ActiveSheet.Rows(1).Columns(3).Interior.Color = &EED2BD
   $Workbook.ActiveSheet.Rows(1).Columns(3).Font.Bold = -1
   $Row = 2
   For Each $App in $List
    If InStr($App,"*")
     $Workbook.ActiveSheet.Rows($Row).Columns(1).Value = Split($App,"*")[0]
     $Workbook.ActiveSheet.Rows($Row).Columns(2).Value = Split($App,"*")[1]
     $Workbook.ActiveSheet.Rows($Row).Columns(3).Value = Split($App,"*")[2]
     $Row=$Row+1
    EndIf
   Next
;   This line adds a hyperlink into the worksheet 
;   $= $Workbook.ActiveSheet.Hyperlinks.Add($Workbook.ActiveSheet.Range("D4") 
;   ,"http://www.kixhelp.com",,"For further information on KiXtart please go here", "KiXhelp") 
 
   $= $Workbook.ActiveSheet.Columns(1).AutoFit
   $= $Workbook.ActiveSheet.Columns(2).AutoFit
   $= $Workbook.ActiveSheet.Columns(3).AutoFit
   $= $Workbook.ActiveSheet.Select
   $Workbook.ActiveSheet.Name = "Software Inventory"
  EndIf
  $= $WorkBook.SaveAs($Output)
  $Workbook = 0
  $Excel.Quit()
  $Excel = 0
 EndIf
 Exit @ERROR
EndFunction
  
Function GetSoftwareInfo()
  Dim $HKLMAppPaths1, $HKLMAppPaths2, $App1, $App2, $key2, $SoftInfo, $Path,$AppName,$AppVer
  Dim $DisplayName, $DisplayVersion, $FileVer
  $HKLMAppPaths1 = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths'
  $HKLMAppPaths2 = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
  $App1=ArrayEnumKey($HKLMAppPaths1)
  $App2=ArrayEnumKey($HKLMAppPaths2)
  For Each $key2 in $App1
    $Path = ReadValue($HKLMAppPaths1 + "\" + $key2,"")
    If Len($Path)
      If InStr($Path,'%') $Path = ExpandEnvironmentVars($Path) EndIf
      If InStr($Path,'"') $Path=Split($Path,'"')[1] EndIf
        $Path       = IIf(InStr($key2,'WRITE.EXE'),'',$Path)
        $Path       = IIf(InStr($key2,'winzip.exe'),'',$Path)
      If Trim(GetFileVersion($Path,'FileDescription')) <> ""
        If Trim(GetFileVersion($Path,'BinFileVersion'))='0.0.0.0'
          $FileVer = 'FileVersion'
        Else
          $FileVer = 'BinFileVersion'
        EndIf
        $SoftInfo = $SoftInfo + Trim(GetFileVersion($Path,'FileDescription')) + Chr(42)
        + $Path + Chr(42) + Trim(GetFileVersion($Path,$FileVer)) + @CRLF
      EndIf
    EndIf
  Next
  For Each $key2 in $App2
    $DisplayName    = ReadValue($HKLMAppPaths2 + "\" + $key2,'DisplayName')
    $DisplayVersion = ReadValue($HKLMAppPaths2 + "\" + $key2,'DisplayVersion')
    $DisplayName    = IIf(InStr($SoftInfo,$DisplayName),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'ACDSee'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Adobe Acrobat 6.0'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Adobe Illustrator'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Adobe Photoshop 5.5'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Adobe Photoshop 6.0'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Adobe Photoshop 7.0'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Adobe Reader'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Alcohol 120'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Dreamweaver MX'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Fireworks MX'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Flash MX'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'FreeHand MX'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'LiveReg'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'LiveUpdate'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'MSN Messenger'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Macromedia FreeHand'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Microsoft Office FrontPage'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Microsoft Outlook'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Net2Phone'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'RoboHelp Office'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'SnagIt'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Symantec AntiVirus'),'',$DisplayName)
    $DisplayName    = IIf(InStr($DisplayName,'Windows Media Encoder'),'',$DisplayName)
    If Len($DisplayName)
      If Len($DisplayVersion)
        $SoftInfo = $SoftInfo + Trim($DisplayName) + Chr(42) + Trim($key2) + Chr(42) + Trim($DisplayVersion) + @CRLF
      EndIf
    EndIf
  Next
  $GetSoftwareInfo=$SoftInfo
EndFunction
 
  
Function ArrayEnumKey($regsubkey)
  Dim $retcode, $subkeycounter, $currentsubkey, $subkeyarray
  If Not KeyExist($regsubkey)
    Exit 87
  EndIf
  $subkeycounter=0
  Do
    $currentsubkey=EnumKey($regsubkey,$subkeycounter)
    If Not @ERROR
      ReDim Preserve $subkeyarray[$subkeycounter]
      $subkeyarray[$subkeycounter]=$currentsubkey
      $subkeycounter=$subkeycounter+1
    EndIf
  Until @ERROR
  $arrayenumkey=$subkeyarray
  Exit 0
EndFunction
 
Function QS($a)
Dim $b[32],$c[32],$d,$e,$f,$g,$h,$i,$j,$k,$l
$b[0]=0
$c[0]=UBound($a)
$d=0
While $d >=0
 $e=$b[$d]
 $f=$c[$d]
 While $e < $f
  $h=$e+($f-$e)/2
  $k=$a[$e]
  $A[$e]=$A[$h]
  $A[$h]=$k
  $i=$e+1
  $j=$f
  $l=0
Do
   While ($i<$j) And $A[$e] > $A[$i]
    $i=$i+1
   Loop
   While ($j>=$i) And $A[$j] > $A[$e]
    $j=$j-1
   Loop
   If $i>=$j
    $l=1
   Else
    $k=$A[$i]
    $A[$i]=$A[$j]
    $A[$j]=$k
    $j=$j-1
    $i=$i+1
   EndIf
Until $l=1
   $k=$a[$e]
   $a[$e]=$a[$j]
   $a[$j]=$k
   $g=$j
   If $g-$e <= $f - $g
    If $g+1 < $f
     $b[$d]=$g+1
     $c[$d]=$f
     $d=$d+1
    EndIf
    $f=$g-1
   Else
    If $g-1 > $e
     $b[$d]=$e
     $c[$d]=$g-1
     $d=$d+1
   EndIf
   $e=$g+1
  EndIf
 Loop
 $d=$d-1
Loop
$qs=$a
EndFunction
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::Mount network drives::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Algemeen drives
Color y+/n
At	(17,10)	"Mounting network drives..."
Color w/b
At	(18,10)	"Mounting drive M: as Algemeen..."
   		Use M: "\\Fileprintserver\Algemeen" 
			Sleep 0.4
At (19,10)	"Mounting drive V: as Groep..."   
   		Use V: "\\Fileprintserver\Groep" 
			Sleep 0.4
At (20,10)	"Mounting drive W: as Groep2..."   
   		Use W: "\\Fileprintserver\Groep2"
   		Sleep 0.4
At (21,10)	"Mounting drive P: as %username%"		
			Use P: "\\Fileprintserver\" + @UserID + "$"
			Sleep 0.4
			
; Afdeling afhankelijke drives

If InGroup("systeembeheer") <> 0
At	(22,10)	"Mounting drive S: as Systeembeheer..." 
			Use S: "\\Fileprintserver\groep\SysteemBeheer"
			Sleep 0.4
EndIf
;
If InGroup("board") <> 0
At	(23.10)	"Mounting drive S: as Directie..." 
			Use S: "\\Fileprintserver\Directie" 
			Sleep 0.4
EndIf
;
If InGroup("Boekhouding") <> 0
At	(24,10)	"Mounting drive S: as Boekhouding..." 
			Use S: "\\Fileprintserver\Boekhouding" 
			Sleep 0.4
EndIf
;
If InGroup("Reception") <> 0
At	(25,10)	"Mounting drive S: as Receptie..." 
			Use S: "\\Fileprintserver\receptie" 
			Sleep 0.4
EndIf  
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::Adding printers:::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Color y+/n
At	(26,10) 	"Adding printers"
Color w/b
At	(27,10)	"Printer HP 2300D Toevoegen..."
If AddPrinterConnection ("\\fileprintserver\HP2300D") = 0
EndIf
At	(28,10)	"Printer HP Deskjet 1220C Toevoegen..."
If AddPrinterConnection ("\\fileprintserver\HP Deskjet 1220C printer") = 0
EndIf 
At	(29,10)	"Printer HP CLJ 3800 Toevoegen..."
If AddPrinterConnection ("\\fileprintserver\HP CLJ 3800") = 0
EndIf 
At	(30,10)	"Printer HP CLJ 4650DN Toevoegen..."
If AddPrinterConnection ("\\fileprintserver\4650DN ColorLaser") = 0
EndIf 
At	(31,10)	"Printer HP CL 4550 Toevoegen..."
If AddPrinterConnection ("\\fileprintserver\HP_CL_4550") = 0
EndIf 
At	(32,10)	"Printer DesignJet 500 Toevoegen..."
If AddPrinterConnection ("\\fileprintserver\DesignJet500") = 0
EndIf 
At	(33,10)	"Printer HP DJ 895 Toevoegen..."
If AddPrinterConnection ("\\fileprintserver\HP_DJ_895") = 0
EndIf 

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::Software scripts::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


;:::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::
;::::Check and install Adobe 8::::
;:::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::
Break on
Color r+/n
At	(35,10)	"Checking adobe version" Sleep 0.5 "." Sleep 0.5 "." Sleep 0.5 "." Sleep 0.5
Dim $key, $ar8, $
$key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

;$ar6 = ReadValue($key + "Adobe Acrobat 6.0","UninstallString")
;$ar7 = ReadValue($key + "Adobe Acrobat 7.0","UninstallString")
;$ar8.oud = KeyExist("HKLM\SOFTWARE\Adobe\Acrobat Reader\8.0")

$ar8 = ReadValue($key + "{AC76BA86-7AD7-1033-7B44-A80000000002}","DisplayVersion") 

;
If $ar8 < "8.0.0"
	MessageBox("Installing Adobe reader 8.0","Installing Adobe",,10) 
	Shell '%systemroot%\system32\msiexec.exe /qb!- /i "\\fileprintserver\Groep2\Software Programs\Adobe\reader 8.0\AcroRead.msi"'
At	(36,10) 	"Updating adobe reader to version 8.0.0..." Sleep 1
Else At (37,10) 	"Adobe reader version up to Date"
EndIf
	
;If $ar6 <> ""
;	MessageBox("Acrobat 6 detected, uninstall. Parse string, add '-y' For quiet mode")
;	$leftpart=Left($uninst,InStr($uninst,"-f")-2)
;	$rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1)
;	$uninst=$leftpart+" -a -x "+$rightpart
;	Shell $uninst
;EndIf
;If $ar7 <> ""
;	MessageBox("Acrobat 7 detected, uninstall. Parse string, add '-y' for quiet mode");
;	$leftpart=Left($uninst,InStr($uninst,"-f")-2)
;	$rightpart=Right($uninst,Len($uninst)-InStr($uninst,"-f")+1)
;	$uninst=$leftpart+" -a -x "+$rightpart
;	Shell $uninst
;EndIf
;If $ar8.oud <> "1"
;	MessageBox("Je hebt nog geen Adobe 8.","Adobe",,2)
;	MessageBox("Installing Adobe Reader 8.0","ESI International",,2)
;	Run "\\fileprintserver\Groep2\Software Programs\Adobe\AdbeRdr80_en_US.exe"
;	;Shell '%systemroot%\system32\msiexec.exe /qb!- /i"\\william\admin\users\adobereader\8\AdobeReader 8.0.msi"'
;	WriteValue ("HKLM\SOFTWARE\Adobe\Acrobat Reader\8.0\AdobeViewer\", "EULA", "1", "REG_DWord")
;
;EndIf
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::Checking errors:::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Color y+/n
? At (39,10) "Press any key to continue..."
Get $
?


_________________________
A mistake is Human, But to make it a real mess you need a computer.

Top
#172863 - 2007-01-17 02:09 AM Re: Mail the Software Inventory [Re: Phoenix1987]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Still need to where it is failing at
_________________________
Today is the tomorrow you worried about yesterday.

Top
#172874 - 2007-01-17 09:35 AM Re: Mail the Software Inventory [Re: Gargoyle]
Phoenix1987 Offline
Fresh Scripter

Registered: 2007-01-02
Posts: 49
Loc: Rotterdam, Netherlands
If Exist($File)
Del $File
EndIf

this is where he stopped on that part.
_________________________
A mistake is Human, But to make it a real mess you need a computer.

Top
#172876 - 2007-01-17 12:16 PM Re: Mail the Software Inventory [Re: Phoenix1987]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
As far as I can see, that is not in your code. What I see in your second last reply is
Code:
If Exist($File)
  Exit
EndIf

Top
#172877 - 2007-01-17 02:04 PM Re: Mail the Software Inventory [Re: Witto]
Phoenix1987 Offline
Fresh Scripter

Registered: 2007-01-02
Posts: 49
Loc: Rotterdam, Netherlands
ow yea sorry thats what i ment.
_________________________
A mistake is Human, But to make it a real mess you need a computer.

Top
#172878 - 2007-01-17 03:25 PM Re: Mail the Software Inventory [Re: Phoenix1987]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
If you want the inventory part of the script to not run if a report from a previous inventory on the specific machine or user is found you can change this:

Code:
If Exist($File)
  Exit
EndIf


to this:

Code:
If Exist($File) = 0
  ;do all inventory stuff here.
EndIf


The other parts of the script that are not doing an inventory or should always run even if the report already exists should be before the IF o rafter the EndIf depending on if the inventory depends on the specific piece of the script. Also you could call the UDF so the script is lots easier to read.
How to call UDF’s? You can put each UDF in a separate file and put this:

Code:
Call @scriptdir + "\someudf.udf"
Call @scriptdir + "\someotherudf.udf"


At the top of the script right after this:

Code:
If Not @LOGONMODE
	     Break On
EndIf


Edited by Mart (2007-01-17 03:34 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#172886 - 2007-01-17 05:34 PM Re: Mail the Software Inventory [Re: Phoenix1987]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Ok, try it this way instead..
Code:
If Not Exist($File)
  $Software = QS(Split(GetSoftwareInfo(),@CRLF))
  ImportToXLS($Software,$File)
  Copy $file "\\fileprintserver\groep\systeembeheer\software overzicht"
EndIf


You had the If Exist Exit - not in a function but in your main script, so you said if the file is there, then exit and so it did.

You just have to follow the logic of what you are telling it to do.


Edited by Gargoyle (2007-01-17 05:35 PM)
_________________________
Today is the tomorrow you worried about yesterday.

Top
#172926 - 2007-01-18 09:14 AM Re: Mail the Software Inventory [Re: Gargoyle]
Phoenix1987 Offline
Fresh Scripter

Registered: 2007-01-02
Posts: 49
Loc: Rotterdam, Netherlands
Originally Posted By: Gargoyle
Ok, try it this way instead..
Code:
If Not Exist($File)
  $Software = QS(Split(GetSoftwareInfo(),@CRLF))
  ImportToXLS($Software,$File)
  Copy $file "\\fileprintserver\groep\systeembeheer\software overzicht"
EndIf


You had the If Exist Exit - not in a function but in your main script, so you said if the file is there, then exit and so it did.

You just have to follow the logic of what you are telling it to do.


Doesnt work also

It stops after the in not exist line.
_________________________
A mistake is Human, But to make it a real mess you need a computer.

Top
#172928 - 2007-01-18 09:58 AM Re: Mail the Software Inventory [Re: Phoenix1987]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Check out my previous post. That should work.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#172935 - 2007-01-18 11:19 AM Re: Mail the Software Inventory [Re: Mart]
Phoenix1987 Offline
Fresh Scripter

Registered: 2007-01-02
Posts: 49
Loc: Rotterdam, Netherlands
Originally Posted By: Mart
Check out my previous post. That should work.


Mart,

At first it didnt work but
I changed to value to 1 and now hes skipping the software part \:D
Thanks

Edit: I removed the file and it doest start making an niet inventory :S


Edited by Phoenix1987 (2007-01-18 11:21 AM)
_________________________
A mistake is Human, But to make it a real mess you need a computer.

Top
#172937 - 2007-01-18 11:36 AM Re: Mail the Software Inventory [Re: Phoenix1987]
Phoenix1987 Offline
Fresh Scripter

Registered: 2007-01-02
Posts: 49
Loc: Rotterdam, Netherlands
I got it working \:D

just move this to before the software script

Code:
Dim $File
$File = '\\fileprintserver\groep\systeembeheer\software overzicht\' + @USERID + '_' + @WKSTA + '.XLS'


Thanks mates
_________________________
A mistake is Human, But to make it a real mess you need a computer.

Top
#176693 - 2007-06-02 12:15 AM Re: Mail the Software Inventory [Re: Phoenix1987]
mrhodes Offline
Fresh Scripter

Registered: 2006-05-24
Posts: 8
I’ve been looking to find how too append the data in a new sheet in one excel doc... I’ve searched with no luck has anyone had success in doing this?
Top
#176694 - 2007-06-02 01:33 AM Re: Mail the Software Inventory [Re: mrhodes]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Search for Excel there is a UDF and a post where it's done already.

If you can't find it I'll search for it later one.

Top
Page 2 of 3 <123>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.079 seconds in which 0.027 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org