Kaseya Community

Problems passing variables to WinXP

  • I've just starting having problems passing variables to Windows XP computers. I've tried using %USERPROFILE% also tried "get variable" using registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop and both work on Vista/Win7 computers.

    Here is the scritp:

    Script Name: Disk Usage Desktop
    Script Description: Used the DU.exe from Sysinternals to report disk usage on CurrentUser\Desktop folder.
    Log file is located in "Get File" under DiskUsage folder.

    IF True
    THEN
    Write File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du.reg
    Parameter 2 : VSASharedFiles\DirSize\du.reg
    OS Type : 0
    Execute Shell Command
    Parameter 1 : regedit /s #vAgentConfiguration.agentTempDir#\du.reg
    Parameter 2 : 0
    OS Type : 0
    Write File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du.exe
    Parameter 2 : VSASharedFiles\DirSize\du.exe
    OS Type : 0
    Get Variable
    Parameter 1 : 0
    Parameter 2 : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop
    Parameter 3 : desktoppath
    OS Type : 0
    Execute Shell Command
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du -q -v #desktoppath# >> #vAgentConfiguration.agentTempDir#\disk_usage_desktop.txt
    Parameter 2 : 0
    OS Type : 0
    Get File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\disk_usage_desktop.txt
    Parameter 2 : DiskUsage\disk_usage_desktop.txt
    Parameter 3 : 1
    OS Type : 0
    Delete File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du.exe
    OS Type : 0
    Delete File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\disk_usage_desktop.txt
    OS Type : 0
    Delete File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du.reg
    OS Type : 0
    ELSE


    Legacy Forum Name: Problems passing variables to WinXP,
    Legacy Posted By Username: cnwicsurrett
  • I'd like to test this, what are the contents of the du.reg?

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty
  • and by the by, %userprofile% is probably failing because of the space in Documents and settings. you might want to try "#desktopPath#"

    Changes I made:
    Disabled the first 2 steps because i dont have the .reg file
    Changed step 4 to use %userprofile%
    Added double quotes around the #desktoppath# variable in step 5
    Added /accepteula switch in step 5 in liu of the .reg file

    Tested on XP and Vista boxs both worked... sorry no windows 7 Yet...

    Script Name: Disk Usage Desktop
    Script Description: Used the DU.exe from Sysinternals to report disk usage on CurrentUser\Desktop folder.
    Log file is located in "Get File" under DiskUsage folder.

    IF True
    THEN
    Write File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du.reg
    Parameter 2 :
    OS Type : -1
    Execute Shell Command
    Parameter 1 : regedit /s #vAgentConfiguration.agentTempDir#\du.reg
    Parameter 2 : 0
    OS Type : -1
    Write File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du.exe
    Parameter 2 : VSASharedFiles\Utils\du.exe
    OS Type : 0
    Get Variable
    Parameter 1 : 2
    Parameter 2 : %userprofile%
    Parameter 3 : desktoppath
    OS Type : 0
    Execute Shell Command
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du -q -v /accepteula "#desktoppath#" >> #vAgentConfiguration.agentTempDir#\disk_usage_desktop.txt
    Parameter 2 : 0
    OS Type : 0
    Get File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\disk_usage_desktop.txt
    Parameter 2 : DiskUsage\disk_usage_desktop.txt
    Parameter 3 : 1
    OS Type : 0
    Delete File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du.exe
    OS Type : 0
    Delete File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\disk_usage_desktop.txt
    OS Type : 0
    Delete File
    Parameter 1 : #vAgentConfiguration.agentTempDir#\du.reg
    OS Type : 0
    ELSE


    Edit/update: Im guessing the .reg file is to prevent the eula thingy from popping up.... no need to post...

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty
  • Using quotes around the variable fixed it. Thanks.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: cnwicsurrett
  • thirteentwenty
    I'd like to test this, what are the contents of the du.reg?


    DU.reg just creates the reg value to accept the EULA.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: cnwicsurrett
  • On the DU command line, add a -accepteula parm to auto accept the EULA

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: dbennett