adamabel1
Level 3

Other questions

Thanks that worked as I expected.  

I actually came back here to post another way I found to do this.  

I spent the last day looking at process monitor logs when you login to the company file or load quickbooks and found that QuickBooks is reading C:\Users\username\AppData\Local\Intuit\QuickBooks 2022\qbwuser.ini and looking for a for a line "DATAFILE=your company file."

If it finds it it'll prompt the username and password.  If not you get to pick a company file when you open quickbooks.  

 

So I wrote a powershell script to look for that string in the file and then remove the line.  If anyone else needs it here it is.  

The reason I am doing this is to get around how poorly the webconnector is programmed.  Often times we have to go into Quickbooks and fix data issues with a sync and when my support people are done and close quickbooks the webconnector won't be able to login if that username and password modal window is up.  

 

#parse file QBWUSER.INI to find line containing "datafile=" and remove that line. This will remove the prompt in QB for a username and password.
$QBWuserpath = "C:\Users\$ENV:USERNAME\AppData\Local\intuit"
$QBWUSERINI = "QBWUSER.INI"
$findQBWuserini = Get-ChildItem -Path $QBWuserpath -Recurse -Filter $QBWUSERINI -File -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
$QBWUSERINIContents = Get-Content $findQBWuserini
#delete "datafile=" and all information after it in that line from $findqbwuserini file
$newcontents = $QBWUSERINIContents -replace 'DATAFILE=.*','' | Set-Content $findQBWuserini

 

Additionally if you want to launch quickbooks with that arguement here is a powershell script do find the qbw.exe and launch it.  

 

$targetFileqb = "QBW.exe"
$basePathqb = "C:\Program Files\Intuit"


# Search for the target file recursively
$foundFilesqb = Get-ChildItem -Path $basePathqb -Recurse -Filter $targetFileqb -File -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
# Check if any files were found
if ($foundFilesqb) {
foreach ($fileqb in $foundFilesqb) {
Write-Host "Launching file: $fileqb"
Start-Process -argumentlist '- QFM ""' -FilePath $fileqb
}
}
else {
Write-Host "File '$targetFileqbw' not found in '$basePathqbw'."
}