Pre-configuring Windows Client

Status
Not open for further replies.

SweetAction

3CX MVP
Gold Partner
Joined
Jan 19, 2018
Messages
3,464
Reaction score
2,324
Hi Team,
I need to roll out 50 windows clients with the settings enabled.

I see these are stored in an XML file located here: - whats your trick for rolling these out systematically (instead of configuring 1 by 1)?

Code:
    <LaunchExternalApplication>True</LaunchExternalApplication>
    <LaunchApplicationExecutablePath>C:\Program Files (x86)\Google\Chrome\Application\chrome.exe</LaunchApplicationExecutablePath>
    <LaunchApplicationParameters>**</LaunchApplicationParameters>
    <LaunchApplicationNotifyWhen>1</LaunchApplicationNotifyWhen>
    <StealFocusOnIncomingCall>True</StealFocusOnIncomingCall>
    <IsCustomImageSet>True</IsCustomImageSet>
    <CustomImagePath>C:\ProgramData\3CXPhone for Windows\PhoneApp\HeaderImage.jpeg</CustomImagePath>
    <IsBusyLampFieldExpanded>True</IsBusyLampFieldExpanded>
 
Hi SweetAction,

There's the option of deploying the app on all machines (if you manage them remotely) and if you know the MAC of each NIC, you can then provision each machine running the 3CX app using the management console like a phone.
 
Hi SweetAction,

There's the option of deploying the app on all machines (if you manage them remotely) and if you know the MAC of each NIC, you can then provision each machine running the 3CX app using the management console like a phone.
How would I do that? I don't see any options in the UI. Is this via import only?
 
So if you launch a Windows Client for example on one PC, but without any configuration.

It will soon appear under the management console phones section. The MAC of that PC will also appear.

You just select it and provision it like you would a deskphone with "Assign Ext"

11697
 
Sure, but I can't set these settings from the 3CX MC when I do that:

11705

That's what I am trying to push out without manually visiting PCs...
 
Sorry SweetAction , I went in a different direction :)

There's no way to do this from the PBX provisioning for those specific parameters.
 
Ok, thanks.

I'll write something to find and replace in the XML file.
 
I face this same issue and have resorted to using a script that modifies the XML with the necessary parameters. The fact that we can not centrally manage the settings of the 3CX Client is one of the main reasons we are going to be unable to deploy 3CX for some of our bigger phone systems.
 
Run powershell script on all the PC's to set the XML settings how you want. There are multiple ways to run scripts remotely, PDQ Deploy is popular. Need to update the original file and destination file to where they are located relative to the script.

Code:
Set-ExecutionPolicy Bypass
$original_file = '3CXPhone.xml'
$destination_file =  '3CXPhone.xml'
(Get-Content $original_file) | Foreach-Object {
    $_ -replace '<LaunchExternalApplication>False</LaunchExternalApplication>', '<LaunchExternalApplication>True</LaunchExternalApplication>' `
       -replace '<LaunchApplicationExecutablePath></LaunchApplicationExecutablePath>', '<LaunchApplicationExecutablePath>C:\Program Files (x86)\Google\Chrome\Application\chrome.exe</LaunchApplicationExecutablePath>' `
       -replace '<LaunchApplicationParameters>%CallerNumber% %CallerDisplayName%</LaunchApplicationParameters>', '<LaunchApplicationParameters>**</LaunchApplicationParameters>' `
       -replace '<LaunchApplicationNotifyWhen>0</LaunchApplicationNotifyWhen>', '<LaunchApplicationNotifyWhen>1</LaunchApplicationNotifyWhen>' `
       -replace '<StealFocusOnIncomingCall>False</StealFocusOnIncomingCall>', '<StealFocusOnIncomingCall>True</StealFocusOnIncomingCall>' `
       -replace '<IsCustomImageSet>False</IsCustomImageSet>', '<IsCustomImageSet>True</IsCustomImageSet>' `
       -replace '<CustomImagePath></CustomImagePath>', '<CustomImagePath>C:\ProgramData\3CXPhone for Windows\PhoneApp\HeaderImage.jpeg</CustomImagePath>' `
       -replace '<IsBusyLampFieldExpanded>False</IsBusyLampFieldExpanded>', '<IsBusyLampFieldExpanded>True</IsBusyLampFieldExpanded>' `
    } | Set-Content $destination_file
 
  • Like
Reactions: SweetAction
The downside is the xml file doesn't exist until the 3cx program is ran on that PC.

Awhile back a post was made detaling how to auto deploy the windows client settings for users. The biggest issue is getting the config files from the welcome emails. I setup a SMTP server to catch all the emails, download the attachments, then renamed them to the user names.

Then setup some bat files and powershell to install 3cx to a pc, check if a username for a config file matched a user folder on that pc indicating that user had logged into it in the past, then run the config file, this generates the users XML file, then copy that xml file to the proper folder in the users appdata.

Now when the user logs into the PC, 3cx opens with their settings and already configured, even if they never open the welcome email.

Code:
rem    This script is to deploy the 3CX Windows Phone client to remote computers
rem    and to copy the users configuration settings along with customized options
rem    directly into the users AppData folder so when they launch 3CX, even for the
rem    first time, they will already have all their settings and company customizations.
rem    There are several pre-requesistes for this script to work properly and they are below.
rem 1. You must save a copy of the 3cxconfig file sent by the Welcome Email for each user.
rem    This is the most time consuming, however 3CX does not offer another way to get these files.
rem 2. Once you have each users welcome email, you need to name them "username".3cxconfig where
rem    "username" is the users domain name. Then copy the file to a network share.
rem 3. This script will only copy the proper 3cx config files to a users AppData folder if both exist.
rem    That means the user must have already logged into the remote pc at some point in the past and
rem    you must have saved the 3cconfig file from the welcome email to the network path.
rem 4. You may be able to break this up, however I have most of it as one long task so that it will only
rem    countinue if the previous commands were succesful. Preventing it from copying files or attempting to
rem    do things that are not needed.
rem 5. The powershell script is a seperate file and is used to modify all users configus with custom settings
rem    that you want company wide. For example having a company logo, brining chat notifications to the front, etc.
rem    You do not need to use it if you want to stick with the default 3cx settings.
rem 6. You will need to make your own CompanyLogo HeaderImage.jpg and place it in the share path you are using to have it replaced.
rem     
rem  The basic steps of the script are in this order:
rem   1. Kill the 3CX processes running on the remote machine to allow overwriting any current 3cx config files.
rem   2. Goto the C:\users folder.
rem   3. Make a users.txt file in C:\temp containg a list of all the user folders in C:\users.
rem   4. Scan the users.txt file getting all the usernames that have logged into the pc before and assing them as %%A.
rem   5. Check to see if 3CX Windows phone is installed on the pc. If it is not it will stop.
rem   6. Copy the users welcome email 3cxconfig file form the network share to c:\temp.
rem   7. Run the 3cxconfig file. This will genereate the 3cxPhone.xml file with the users settings and place it under
rem      the AppData folder for the account that is running the script.
rem   8. Take a 3 second pause for the 3cx windows client to fully launch and generate the 3cxPhone.xml file.
rem   9. Copy newly generated 3CXPhone.xml file from the user account that is running the batch file and place it in
rem      the users AppData folder that the config file corresponds with.
rem  10. Kill the 3CXPhone process that is running in the background created by executing the 3cxconfig file.
rem  11. Delete the Welcome Email 3cxconfig file that was copied to c:\temp.
rem  12. Delete the Users.txt file created in C:\temp and delete 3CXPhone.html in script runner user's folder.
rem  13. Goto c:\temp.
rem  14. Scan the C:\users directory for all users,
rem  15. Check if they have a 3cxconfig file already setup for their user name.
rem  16. If they do, Copy the powershell script to modify the config file for that user.
rem  17. Copy the companyheader logo you want to use for that client.
rem  17. Run the powershell script
rem  18. The powershell script scans the users config file and replacees whatever settings you want with new ones.
rem
rem
rem   Feel free to modify this all you want, I hoping it won't be useful for much longer considering 3CX is working hard towards
rem   allowing management of the Softphone app from within the 3CX console.
rem

rem   Below is the powershell script. Copy it and save it to a text file with the name of 3cxscript.ps1 (not ending in .txt)
rem   Make sure to remove all the "rem" comments at the beginning of each line and the additonal two spaces.

rem  (Copy below this line)
rem
rem  Set-ExecutionPolicy RemoteSigned
rem  $original_file = '3CXPhone.xml'
rem  $destination_file =  '3CXPhone.xml'
rem  (Get-Content $original_file) | Foreach-Object {
rem      $_ -replace '<IsCustomImageSet>False</IsCustomImageSet>', '<IsCustomImageSet>True</IsCustomImageSet>' `
rem         -replace '<CustomImagePath></CustomImagePath>', '<CustomImagePath>C:\ProgramData\3CXPhone for Windows\PhoneApp\HeaderImage.jpeg</CustomImagePath>' `
rem         -replace '<ApplicationTheme>3</ApplicationTheme>', '<ApplicationTheme>1</ApplicationTheme>' `
rem         -replace '<ApplicationTheme>2</ApplicationTheme>', '<ApplicationTheme>1</ApplicationTheme>' `
rem         -replace '<StealFocusOnIncomingCall>False</StealFocusOnIncomingCall>', '<StealFocusOnIncomingCall>True</StealFocusOnIncomingCall>' `
rem         -replace '<AutomaticallyOpenChatWindow>False</AutomaticallyOpenChatWindow>', '<AutomaticallyOpenChatWindow>True</AutomaticallyOpenChatWindow>' `
rem      } | Set-Content $destination_file
rem
rem   (Copy above this line)
rem
rem  If you want to install the 3cx client as well just add the below lines and remove the "rem" tags.
rem
rem  cd c:\temp\
rem  xcopy /f /i /y "(NWPATH)\3CXPhoneforWindows15.msi" "C:\temp\3CXPhoneforWindows15.msi*"
rem  msiexec /i 3CXPhoneforWindows15.msi /quiet
rem
rem






rem  Step 1
taskkill /FI "WINDOWTITLE eq 3CX*" /F
taskkill /im 3CXWin8Phone.exe /f
taskkill /im 3CXWIN~1.exe /f

rem Step 2
cd C:\users\

rem Step 3
dir /b > C:\temp\users.txt

rem Steps 4-11
for /F %%A in (C:\temp\users.txt) do if exist "C:\ProgramData\3CXPhone for Windows\PhoneApp\" xcopy /f /i /y "(NWPATH)\%%A.3cxconfig" "c:\temp\%%A.3cxconfig*" && cd C:\temp\ && del "C:\users\(deployuser)\appdata\roaming\3cxphone for windows\3CXPhone.xml.back"  && del "C:\users\(deployuser)\appdata\roaming\3cxphone for windows\3CXPhone.xml" && ping localhost -n 10 >NUL && start "C:\temp\%%A.3cxconfig" && ping localhost -n 10 >NUL && xcopy /f /i /y "C:\users\(deployuser)\appdata\roaming\3cxphone for windows\3CXPhone.xml" "C:\Users\%%A\AppData\Roaming\3CXPhone for Windows\3CXPhone.xml" && taskkill /FI "WINDOWTITLE eq 3CX*" /F && taskkill /im 3CXWin8Phone.exe /f && taskkill /im 3CXWIN~1.exe /f && del "C:\users\(deployuser)\appdata\roaming\3cxphone for windows\3CXPhone.xml" && del "C:\temp\%%A.3cxconfig" && ping localhost -n 10 >NUL && del "C:\users\(deployuser)\appdata\roaming\3cxphone for windows\3CXPhone.xml.back"  && del "C:\users\(deployuser)\appdata\roaming\3cxphone for windows\3CXPhone.xml"

rem Step 12
del "C:\temp\users.txt"

rem Step 13
cd C:\temp

rem Step 14-18
for /d %%B in (C:\Users\*) do if exist "%%B\AppData\Roaming\3CXPhone for Windows\" cd %%B\AppData\Roaming\3CXPhone for Windows && copy /y \\(NWPATH)\3cxscript.ps1 && copy /y \\(NWPATH)\HeaderImage.jpeg "C:\ProgramData\3CXPhone for Windows\PhoneApp\HeaderImage.jpeg" && copy /y \\(NWPATH)\Default.wma "C:\ProgramData\3CXPhone for Windows\PhoneApp\Notifications\Default.wma" && powershell -ExecutionPolicy ByPass -File .\3cxscript.ps1
 
@dan_tx Thanks for this. Too late for my project ) - I ended up writing my own scripts, but this is great info and I appreciate you providing it.
 
Status
Not open for further replies.

Forum statistics

Threads
112,025
Messages
590,365
Members
164,976
Latest member
Roman Mazur