Node.js Setup fails. Where is the log? - node.js

Busy trying to setup node.js via the windows download on the nodejs website. It seems run along ok right until the end when it hits the "creating shortcurts..." then starts to rollback and get a pretty useless general error.
Are there no log files I can check to see whats going on?

My preferred option is to use the command line msiexec tool as indicated on WiX's website:
msiexec /i MyApplication.msi /l*v MyLogFile.txt
Another option that I've never used is to edit the registry as indicated on Microsoft's website:
To enable Windows Installer logging yourself, open the registry with Regedit.exe and create the following path and keys:
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer
Reg_SZ: Logging
Value: voicewarmupx
The letters in the value field can be in any order. Each letter turns on a different logging mode. Each letter's actual function is as follows for MSI version 1.1:
v - Verbose output
o - Out-of-disk-space messages
i - Status messages
c - Initial UI parameters
e - All error messages
w - Non-fatal warnings
a - Start up of actions
r - Action-specific records
m - Out-of-memory or fatal exit information
u - User requests
p - Terminal properties
+ - Append to existing file
! - Flush each line to the log
x - Extra debugging information. The "x" flag is available only on Windows Server 2003 and later operating systems, and on the MSI redistributable version 3.0, and on later versions of the MSI redistributable.
"*" - Wildcard, log all information except for the v and the x option. To include the v and the x option, specify "/l*vx".
Note This should be used only for troubleshooting purposes and should not be left on because it will have adverse effects on system performance and disk space. Each time you use the Add/Remove Programs tool in Control Panel, a new Msi*.log file is created.

Related

XSCT executes command in interactive shell but not within script

First, take note that I am using the Xilinx SDK 2018.2 on Kubuntu 22.04 because of my companies policy. I know from research, that the command I'm using is deprecated in newer versions, but in the version I am using, it works flawlessly - kind of... But read for yourself:
My task is to automate all steps in the FPGA build to create a pipeline which automatically builds and tests the FPGAs. To achieve this, I need to build the code - this works flawlessly in XSDK. For automation, this also has to work in the command line, so what I did is following the manual to find out how this is achieved. Everything works as expected if I write it in the interactive prompt like shown here:
user#ubuntuvm:~$ xsct
****** Xilinx Software Commandline Tool (XSCT) v2018.2
**** Build date : Jun 14 2018-20:18:43
** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
xsct%
Then I can enter the commands I need to import all needed files and projects (hw, bsp, main project). With this toolset, everything works as expected.
Because I want to automate it via a pipeline, I decided to pack this into a script for easier access. The script contains exactly the commands I entered in the interactive shell and therefore looks like this:
user#ubuntuvm:~/gitrepos/repository$ cat ../autoBuildScript.tcl
setws /home/user/gitrepos/repository
openhw ./hps_packages/system.hdf
openbsp ./bsp_packages/system.mss
importprojects ./sources/mainApp
importprojects ./bsp_packages
importprojects ./hps_packages
regenbsp -bsp ./bsp_packages/system.mss
projects –clean
projects -build
The commands are identical to the ones entered via the interactive CLI tool, the only difference is that this is now packed into a script. The difference is, that this now does not build completely anymore. I get the following error:
user#ubuntuvm:~/gitrepos/repository$ xsct ../autoBuildScript.tcl
INFO: [Hsi 55-1698] elapsed time for repository loading 1 seconds
Starting xsdk. This could take few seconds... done
'mainApp' will not be imported... [ALREADY EXIST]
'bsp_packages' will not be imported... [ALREADY EXIST]
'hps_packages' will not be imported... [ALREADY EXIST]
/opt/Xilinx/SDK/2018.2/gnu/microblaze/lin
unexpected arguments: –clean
while executing
"error "unexpected arguments: $arglist""
(procedure "::xsdb::get_options" line 69)
invoked from within
"::xsdb::get_options args $options"
(procedure "projects" line 12)
invoked from within
"projects –clean"
(file "../autoBuildScript.tcl" line 8)
I've inserted projects -clean only, because I got the error before with projects -build and wanted to check, if this also happens with another argument.
In the internet I didn't really find anything according to my specific problem. Also I strictly held on to the official manual, in which the command is also used just as I use it - but with the result of it being working.
Also, I've checked the line endings (set to UNIX) because I suspected xsct to read maybe a newline character or something similar, with no result. This error also occurs, when I create the bsp and hardware from sketch. Also, to me the error looks like an internal one from Xilinx, but let me know what you think.
So, it appears that I just fixed the problem on my own. Thanks on everyone reading for being my rubber ducky.
Apparently, the version 2018.2 of XSDK has a few bugs, including inconsistency with their command interpretation. For some reason the command works in the interactive shell, but not in the script - because the command is in its short form. I just learned from a Xilinx tutorial, that projects -build is - even though it works - apparently not the full command. You usually need to clarify, that this command should come from the SDK like this: sdk projects -build. The interactive shell seems to ignore this fact for a reason - and so does the script for any command except projects. Therefore, I added the "sdk" prefix to all commands which I used from the SDK, just to be safe.
I cannot believe, that I just debugged 2 days for an error whose fix only contains 3 (+1 whitespace) letters.
Thanks everybody for reading and have a nice day

Start OneDrive Under Full Admin Rights

Summary
I necessarily run Excel with Admin privileges and I have UAC set to Never Notify. Excel VBA opens Word. Word has a macro button that restarts OneDrive. The error message is that "OneDrive can't be run using full admin rights." How can I restart OneDrive without the error massage?
Note: There is a sister post at How to Restart OneDrive via VBA When Running Excel Elevated, but that post poses an entirely different question.
Workflow
Excel VBA opens Word:
Sub m_Test_Finish_WordDoc()
Const strpath = "C:\Users\ssttr\OneDrive\Documents\Investing\Automation\Static Inputs\Restart_OneDrive.docm"
Dim Wd As Object
Dim InstrDoc As Object
Dim f As Boolean
On Error Resume Next
Set InstrDoc = GetObject(strpath)
With InstrDoc.Parent
.Visible = True
.Activate
End With
End Sub
Word macro restarts OneDrive:
Private Sub CommandButton1_Click()
Application.Run "Restart_OneDrive"
End Sub
Sub Restart_OneDrive()
'Restarts OneDrive
Dim shell
Set shell = CreateObject("wscript.shell")
shell.Run """C:\Users\ssttr\OneDrive\Documents\Investing\Automation\Static Inputs\OneDrive Restart - Copy.bat""" 'bat.zzz
End Sub
Contents of OneDrive Restart - Copy.bat
REM Restarts OneDrive from the command line.
REM From https://stackoverflow.com/questions/29872973/syncing-onedrive-skydrive-with-batch-file-via-cmd.
REM If the /background switch is omitted then Explorer is opened to the OneDrive folder in your user profile but OneDrive does not start.
REM If restarting OneDrive from a batch file then add the START command or the batch file won't end.
REM start %LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe /background <-- the original '~error-producing' command
RunWithRestrictedRights %LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe -w -v
One Possible Path to a Solution
I downloaded the RunWithRestrictedRights.exe standalone executable from https://www.coretechnologies.com/products/RunWithRestrictedRights/ into the C:\Windows\System32 directory and the implementation (shown above) in VBA was replacing the
start %LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe /background
line in my batch file (which BTW is from Syncing OneDrive (SkyDrive) with Batch File (via cmd))
with
RunWithRestrictedRights %LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe.
Note that, as required at the very bottom of https://www.coretechnologies.com/products/RunWithRestrictedRights/, I added the Administrator to the security policy settings for "Replace a process level token" and for "Adjust memory quotas." See below Notes > SecPol.msc §.
The hang-up is when that the batch file, when called in the above process (Important: remember Excel is Run As Admin), runs (i.e. cmd window flashes) but it does not open OneDrive.
Is my problem, as I suspect, in my batch file, or somewhere else? If somewhere else, then you may wish to see my sister post (it is the same underlying issue but pursing a very different question) at How to Restart OneDrive via VBA When Running Excel Elevated.
Notes:
Things that didn't work for me:
There was some stuff about UAC being required relative to an elevated launch of OneDrive, but that's a non-starter for me because if a user needs to attend to a UAC prompt, then my code's purpose of full automation is negated. Also, for my purposes, I have UAC set to Never Notify.
From https://superuser.com/questions/171917/force-a-program-to-run-without-administrator-privileges-or-uac/450503#450503 -- The MS RunAsInvoker Application Compatibility Toolkit shim does not apply bc I have UAC turned off by default.
FWIW, I did try setting UAC to Always Notify but it did not remove the error. I also tried RunAs /trustlevel:0x20000 %LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe, and it did not seem to work, which is because per https://www.coretechnologies.com/products/RunWithRestrictedRights/ I have UAC disabled.
Origins of the solution I am pursuing:
From https://www.coretechnologies.com/blog/alwaysup/onedrive-hates-admin-rights/ -- "UAC enables an administrator to run OneDrive normally" section -- this is a really informative and provided the final solution
SecPol.msc
From https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/replace-a-process-level-token -- "This policy setting determines which parent processes can replace the access token (editor's note - describes the security context of a process or thread) that is associated with a child process." That's the lynch pin setting.
I set that per https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/user-rights-assignment and https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/how-to-configure-security-policy-settings.
I also had to set Adjust memory quotas for a process per https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/adjust-memory-quotas-for-a-process and https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/how-to-configure-security-policy-settings.
Per https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/how-to-configure-security-policy-settings, "any change to the user rights assignment for an account becomes effective the next time the owner of the account logs on." so I restarted (after I tested and confirmed it did not work without a restart).
Update 2022-01-07-18.7
I've moved from a *.bat because I was passing multiple commands, to attempting to directly implement the command by way of:
Sub Restart_OneDrive()
Dim RWRR As Variant
RWRR = shell("RunWithRestrictedRights.exe ""C:\Users\ssttr\AppData\Local\Microsoft\OneDrive\OneDrive.exe"" -w -p -v", vbNormalFocus)
End Sub
but I get Run-time error '53': File not found.
The error still occurs if I change to
RWRR = shell("C:/Windows/System32/RunWithRestrictedRights.exe ""C:\Users\ssttr\AppData\Local\Microsoft\OneDrive\OneDrive.exe"" -w -p -v", vbNormalFocus)
or to
Call shell("RunWithRestrictedRights ""C:\Users\ssttr\AppData\Local\Microsoft\OneDrive\OneDrive.exe""", vbNormalFocus)
I have the required security policy set per https://www.coretechnologies.com/products/RunWithRestrictedRights/ :
which states:
Does RunWithRestrictedRights.exe work on Windows XP and Windows Server
2003, where there is no UAC?
Yes, it works well on Windows XP and Windows Server 2003. The Windows
Integrity Level can't be set (that feature is only available in
Windows Vista and later) but the application is run without admin
rights as intended.
One note though: If you receive an error stating that "a required
privilege is not held by the client", please ensure that your account
has these two rights: Adjust memory quotas for a process; Replace a
process level token.
If I run directly from a non-elevated command line
RunWithRestrictedRights.exe "C:\Users\ssttr\AppData\Local\Microsoft\OneDrive\OneDrive.exe" -w -p -v
or
C:/Windows/System32/RunWithRestrictedRights.exe "C:\Users\ssttr\AppData\Local\Microsoft\OneDrive\OneDrive.exe"```` or ````RunWithRestrictedRights "C:\Users\ssttr\AppData\Local\Microsoft\OneDrive\OneDrive.exe" -w -p -v
it works, resulting in:
I have tried all these syntax commands inside the shell, with what I think are the appropriate syntax changes, e.g. as shown the above VBA above, but still get the run time error 53.
FWIW here's the help for RunWithRestrictedRights.exe:
which says:
RunWithRestrictedRights
Synopsis: Runs a given application in a "restricted" mode - at Medium
(or Low) Integrity and without rights granted by being a member
of the Administrators group.
Usage: RunWithRestrictedRights.exe [-w] [-l] [-p]
[-v]
[-d ]
Options:
The full path to the application to be started. Please be
sure to enclose the path in quotes if it contains at least
one space.
-w Instead of returning immediately after launching the
application, wait until the application ends. Optional.
-l Instead of running the application with Medium Integrity,
start it with Low Integrity. Optional.
-p Also strip away rights granted from being a member of the
"Power Users" group. Optional.
-d Also deny rights to the given SID.
-v Produce verbose output. Optional.
Exit code: The non-zero process identifier (PID) if the
application
was successfully started.
-1 if there was an error starting the application.
Version: 3.0.1.16 (Feb 18 2020)
Example: > RunWithRestrictedRights.exe "C:\MyApp\MyApp.exe"
- Starts MyApp.exe with retricted rights.
This free utility is Copyright 2020, Core Technologies Consulting,
LLC. Find out about this and our other products at our web site:
https://www.CoreTechnologies.com/

SSIS package works from SSMS but not from agent job

I've an SSIS package to load excel file from network drive. It's designed to load content and then move the file to archived folder.
Everything works good when the following SQL statement runs in SSMS window.
However when it's copied to SQL agent job and executes from there, the file is neither loaded nor moved. But it shows "successful" from the agent log.
The same thing also happened to "SSIS job" instead of T-SQL job, even with proxy of windows account.(same account as ssms login)
Declare #execution_id bigint
EXEC [SSISDB].[catalog].[create_execution] #package_name=N'SG_Excel.dtsx', #execution_id=#execution_id OUTPUT, #folder_name=N'ETL', #project_name=N'Report', #use32bitruntime=True, #reference_id=Null
Select #execution_id
DECLARE #var0 smallint = 1
EXEC [SSISDB].[catalog].[set_execution_parameter_value] #execution_id, #object_type=50, #parameter_name=N'LOGGING_LEVEL', #parameter_value=#var0
EXEC [SSISDB].[catalog].[start_execution] #execution_id
GO
P.S. At first relative path of network drive is applied, then switched to absolute path(\\server\folder). It's not solving the issue.
SSIS Package Jobs run under the context of the SQL Server Agent. What Account is setup to run the SQL Server Agent on the SQL Server? It may need to be run as a Domain account that has access to the network share.
Or you can copy the Excel file to local folder on the SQL Server, so the Package can access the file there.
Personally I avoid the File System Task - I have found it unreliable. I would replace that with a Script Task, and use .NET methods from the System.IO namespace e.g. File.Move. These are way more reliable and have mature error handling.
Here's a starting point for the System.IO namespace:
https://msdn.microsoft.com/en-us/library/ms404278.aspx
Be sure to select the relevant .NET version using the Other Versions link.
When I have seen things like this in the past it's been that my package isn't accessing the path I thought it was at run time, its looking somewhere else, finding an empty folder & exiting with success.
SSIS can have a nasty habit of going back to variable defaults . It may be looking at a different path you used in dev? Maybe hard code all path values as a test? or put in break points & double check the run time values of all variables & parameters.
Other long shots may be:
Name resolution, are you sure the network name is resolving correctly at runtime?
32/64 bit issues. Dev tends to run 32 bit, live may be 64 bit. May interfere with file paths? Maybe force to 32 bit at run time?
There is issue with sql statement not having statement terminator (;) that is causing issue.
Declare #execution_id bigint ;
EXEC [SSISDB].[catalog].[create_execution] #package_name=N'SG_Excel.dtsx', #execution_id=#execution_id OUTPUT, #folder_name=N'ETL', #project_name=N'Report', #use32bitruntime=True, #reference_id=Null ;
Select #execution_id ;
DECLARE #var0 smallint = 1 ;
EXEC [SSISDB].[catalog].[set_execution_parameter_value] #execution_id, #object_type=50, #parameter_name=N'LOGGING_LEVEL', #parameter_value=#var0 ;
EXEC [SSISDB].[catalog].[start_execution] #execution_id ;
GO
I have faced similar issue in service broker ..

Adding to the PATH on Windows in node.js - sending WM_SETTINGCHANGE?

I'm writing an installation script (in node.js, specificially slush/gulp although I don't think that matters) that sets up some common tools on our developer machines.
For one of these tools, I need to modify the PATH environment variable on Windows machines.
So far the best way I've found to do this is using the winreg package to modify the Registry directly (in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path), which works great (aside from the need to run the entire install script in an elevanted command prompt).
However, it requires either a machine restart for the new PATH to take effect (not even just opening a new command prompt, as it would usually), OR sending the user into their system preferences to just open up the Environment Variables dialog box and click OK.
This detailed answer covers some of what needs to happen beneath the hood when you change an environment variable programmatically. I'm assuming the WM_SETTINGCHANGE message (details here) is sent to the system when clicking OK in that Environment Variables dialog box.
So, how could I go about sending the WM_SETTINGCHANGE message from node.js? Is that possible?
I can offer non-native solution (not sure if native exists). It updated the value for me without restarts.
I'm talking about reg.exe tool that is shipped with Windows starting at least from Windows XP.
The algorithm:
1. Form a command for update, e.g.:
const scriptContent = `REG ADD HKCU\\Environment /v Path /t REG_SZ /d "${newPath}" /f`
HKCU\Environment - is the path to your variable in registry,
Path - name of the variable to update,
REG_SZ - type of the variable,
"${newPath}" - new PATH contents (fully old content with added new paths. Using quotes just in case we have white spaces there),
/f - force rewrite (basically, this command is for creation. So, if this variable doesn't exist, it will be created, otherwise - overwritten).
2. Write this contents to a script file, e.g. script.bat:
const fs = require("fs");
const scriptPath = 'script.bat';
fs.writeFile(scriptPath, scriptContent);
3. Execute the script file:
const child_process = require("child_process");
child_process.exec(scriptPath);

Directly run compiled VB6 exe - Automation Error 2147417848 & Access violation reading location 0x01289B5C

I got the really common Automation Error when I ran a VB6 application for the second time. However, the code worked fine under VB6 debugging mode. After I compiled the code and run some function for the second time, I would encounter the Automation Error 2147417848 - The object invoked has disconnected from its clients.
Then I debugged the application thru Visual Studio and got the following exception error:
Unhandled exception at 0x76B33E8D (oleaut32.dll) in vb6_2_12_2015.exe: 0xC0000005: Access violation reading location 0x01289B5C.
Is it because of something wrong with my dll registration?
The message means your program is accessing memory (ie a variable or object) that has been freed or never existed (usually because creation failed and the programmer didn't check). A memory address under 64K indicates a failed allocation.
To start with, compile your program without optimisations and with debugging info. When you crash do a stack trace which will list functions and parameters.
You can also start in a debugger.
windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.
Download and install Debugging Tools for Windows
http://msdn.microsoft.com/en-us/windows/hardware/hh852363
Install the Windows SDK but just choose the debugging tools.
Create a folder called Symbols in C:\
Start Windbg. File menu - Symbol File Path and enter
srv*C:\symbols*http://msdl.microsoft.com/download/symbols
then
windbg -o -g -G c:\windows\system32\cmd.exe /k batfile.bat
You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.
Type lm to list loaded modules, x *!* to list the symbols and bp symbolname to set a breakpoint
da displays the ascii data found at that address
dda displaysthe value of the pointer
kv 10 displays last 10 stack frames
lm list modules
x *!* list all functions in all modules
p Step
!sysinfo machineid
If programming in VB6 then this environmental variable link=/pdb:none stores the symbols in the dll rather than seperate files. Make sure you compile the program with No Optimisations and tick the box for Create Symbolic Debug Info. Both on the Compile tab in the Project's Properties.
Also CoClassSyms (microsoft.com/msj/0399/hood/hood0399.aspx) can make symbols from type libraries.
.

Resources