How to renew the SAS 9.3 license.
We use SAS 9.3 in both the 64 abd 32bit versions in our environment. I'd like to be able to renew the license using KACE. I have a batch file that works for each version of the software. They both call the sasrenew.exe file from a different directory based on which version is installed. If possible, I'd like for it to check for the existing of the directory and file (i.e. "C:\Program Files\SASHome\x86\SASRenewalUtility\9.3\SASRenew.exe", or "C:\Program Files\SASHome\SASRenewalUtility\9.3\SASRenew.exe" ) then run the batch file that uses the right version of the license file ("-skipadmincheck -s "datafile:\\server\install\SAS_Software_Depot\sid_files\SAS93_***_***_Win_Wrkstn.txt", or -skipadmincheck -s "datafile:\\server\install\SAS_Software_Depot\sid_files\SAS93_***_***_Win_X64_Wrkstn.txt").
Darrell
Answers (3)
if "%PROCESSOR_ARCHITECTURE%"=="x86" C:\Program Files\SASHome\x86\SASRenewalUtility\9.3\SASRenew.exe -skipadmincheck -s "datafile:\\server\install\SAS_Software_Depot\sid_files\SAS93_***_***_Win_Wrkstn.txt
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" C:\Program Files\SASHome\SASRenewalUtility\9.3\SASRenew.exe -skipadmincheck -s "datafile:\\server\install\SAS_Software_Depot\sid_files\SAS93_***_***_Win_X64_Wrkstn.txt
We use SCCM + a batch file
The line that checks the SAS version in our renewal script is :
"dir "c:\program files\sasHome\licenses\*Win_X64_Wrkstn.txt" /b /a | find /v "nofiles">nul || goto 32Bit"
Basically does a dir, if it doesn't find any files that end in Win_X64_Wrkstn.txt it assumes it is the 32bit version and uses the appropriate update path/file
Below is the full script:
---------------------------------------------------------------------------------------
@echo off
:: SAS Annual License renewal.
::Prep
set SAS32bitKey=SAS93_XXXXXXXXXXXX_Win_Wrkstn.txt
set SAS64bitKey=SAS93_XXXXXXXXXXXX_Win_X64_Wrkstn.txt
echo. >>%windir%\temp\SAS-Renewal.log
echo %date% %time% Starting >>%windir%\temp\SAS-Renewal.log
:: check that SAS is the right version (currently 9.3)
dir "c:\program files\sas_license\SAS93*" /b /a | find /v "nofiles">nul || goto abort
::check if SAS install is 32 or 64bit
dir "c:\program files\sasHome\licenses\*Win_X64_Wrkstn.txt" /b /a | find /v "nofiles">nul || goto 32Bit
:64Bit
echo 64bit license being renewed >>%windir%\temp\SAS-Renewal.log
::Copy renewal license
copy %SAS64bitKey% "C:\Program Files\Sas_license" /y >>%windir%\temp\SAS-Renewal.log
::Renew License - note path is different to 32bit install
"C:\Program Files\SASHome\SASRenewalUtility\9.3\SASRenew.exe" -s "datafile:C:\Program Files\Sas_license\%SAS64bitKey%"
goto eof
:32Bit
echo 32bit license being renewed >>%windir%\temp\SAS-Renewal.log
::Copy renewal license
copy %SAS32bitKey% "C:\Program Files\Sas_license" /y >>%windir%\temp\SAS-Renewal.log
::Renew License - note path is different to 64bit install.
"C:\Program Files\SASHome\x86\SASRenewalUtility\9.3\SASRenew.exe" -s "datafile:C:\Program Files\Sas_license\%SAS32bitKey%"
goto eof
:abort
echo wrong SAS version aborting >>%windir%\temp\SAS-Renewal.log
exit 1603
:eof
::force a 15 sec delay
timeout /t 5 /nobreak >null
set SAS32bitKey=
set SAS64bitKey=
echo %date% %time% Finished >>%windir%\temp\SAS-Renewal.log
--------------------------------------------------------------------------------------------------
Personally, I'd be doing that in VBScript rather than batch, mostly because of its superior error-handling. - anonymous_9363 9 years ago