Edit DCOM protocols programmatically - windows

I need to automate a manipulation through powershell, but I just don't know how to do so.
Here is the manual procedure:
Click on "Component Services":
Click on "Property" of the computer
Click on "Property" of the "TCP/IP connexion"
Add a port range
Enter a port range, then hit "OK"
I searched for quite a while online, and got some clues on how to do access the related WMI Object, but from there, I am stuck. I used trial and error to no avail.
If anyone has ever done this, or know more about it, I would be glad to know it.

Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet
ValueName: Ports
Type: REG_MULTI_SZ
Example export of the key from Regedit.exe, from Windows Server 2016, for ports: 60001-61248:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Rpc\Internet]
"PortsInternetAvailable"="N"
"UseInternetPorts"="N"
"Ports"=hex(7):36,00,30,00,30,00,30,00,31,00,2d,00,36,00,31,00,32,00,34,00,38,\
00,00,00,00,00,00,00
A link describing these settings in more detail is:
How to configure RPC dynamic port allocation to work with firewalls
I originally found a hint to this registry key on this web page: Troubleshooting RPC Endpoint Mapper errors using the Windows Server 2003 Support Tools from the product CD

Related

How to disable "file risk warning prompt" in windows 7?

I'm trying to edit a document from an alfresco repository using MS word via the AOS module. Unfortunately I get a warning prompt about this all the time.
The message in the prompt reads to this effect:
Some files can harm the computer. If the file information below looks
suspicious or if you do not fully trust the source, then do not open
the file.
I have so far used inetcpl to configure the trusted sites for the intranet zones and added the domains to the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains
following the instructions from this site and some others (which all practically allude to the same thing) but so far I have had zero success in disabling the thing.
OS: windows 7
EDCM: Alfresco 5.2 with AOS
Browser: Internet Explorer 11
Your error message is not in English language, So it is difficult for us to understand which actual error you are getting.
If you are trying to open file via IE and getting security warning for opening a file then you can refer steps below to stop it.
(1) Open Internet Explorer.
(2) Go to Tools.
(3) Click on Internet Options.
(4) Select Security tab.
(5) Click button named as 'Custom level'.
(6) Find an option called 'Launching applications and unsafe files(not secure)'.
(7) Enable it.
(8) Restart the Internet Explorer.
Note: It is not recommended to enable this option for a security reason. You can try to make a test with it to check whether it can solve your issue or not.

Google Chrome does not open custom protocols

I've been using a simple mechanism for registering a custom URL protocol on Windows 10, allowing a link in our web application to launch a local program on the client computer. For example :
Launch program
In regedit, the protocol is registered here :
Ordinateur\HKEY_CLASSES_ROOT\mycustomprotocol\shell\open\command
with a value like :
C:\Program Files (x86)\MyProgram\MyExecutable.exe "%1"
It has stopped to work on Chrome 63. Nothing is shown in the dev console nor in the network tab, whereas it still works well on Firefox or Microsoft Edge for example.
If I delete my user profile in C:\Users\johndoe\AppData\Local\Google\Chrome\User Data, then click my custom link again, Chrome asks me if I want to launch my local program but nothing happens when I click on the "open" button.
Any though ? Is this feature now blocked by Chrome ? Can this be unblocked ? Thanks for your help.
Turns out that I was missing two keys in the registry. It was okay for Edge but not for Chrome. Here are the keys to add at the level Computer\HKEY_CLASSES_ROOT\mycustomprotocol\ :
Name Type Data
(Default) REG_SZ URL:My Fancy Program
URL Protocol REG_SZ
This Chrome bug has just been fixed:
https://bugs.chromium.org/p/chromium/issues/detail?id=788431
If you don't want to wait for the fix to be deployed, this discussion on Reddit gives a possible solution.
We are also facing the same of Custom Protocol in Chrome 63.
The protocol is registered here :
Ordinateur\HKEY_CLASSES_ROOT\mycustomprotocol\shell\open\command
with a value like :
C:\Program Files (x86)\MyProgram\MyExecutable.exe "%1"
Also we have both the registry entries under Computer\HKEY_CLASSES_ROOT\mycustomprotocol\
Name Type Data
(Default) REG_SZ URL:My Fancy Program
URL Protocol REG_SZ
Browser opens the popup to allow user to launch client application. Client application launches. But always allow option is not getting save. Browser always opening popup to launch the client application
Set Chrome policies for devices
via https://support.google.com/chrome/a/answer/187202?hl=en&ref_topic=2936229

Outlook form VBScript won't run

I'm designing a Outlook Contact form. None of the sample code I've tried to put in the View Code button's Script Editor does anything. The most basic example is:
Sub Item_Open()
msgbox "Hello World"
End Sub
When I click the Run This Form button, no message box or error message appears. It seems to totally ignore the VBScript. The same thing happens with every bit of sample code I've tried.
This is my first time doing any development for Office or in VBA or VBScript, so I assume I'm missing something basic, but I've watched and read a few tutorials, doing exactly what was shown and nothing works. I can design and publish a Contact form with custom fields and and basic combo boxes.
In the Trust Center I have Macro Settings set to "Notifications for all macros" and the Email Security options "Allow script in shared folders" and "Allow script in Public Folders" are both checked.
I'm designing a Contact form using Office 365 32-bit Version 1708 (Build 8431.2079 Click-to-Run) Monthly Channel on Windows 10 x64 Version 1703 Build 15063.608.
Any help would be greatly appreciated!!
Thank you!
The solution was to add some registry keys as described in the 2 articles below.
Custom form scripts now require registry settings to be added.
https://support.office.com/en-us/article/Custom-form-script-is-now-disabled-by-default-bd8ea308-733f-4728-bfcc-d7cce0120e94
https://www.slipstick.com/outlook/custom-form-security/
The registry settings mentioned there fixed my issue.
Possible causes:
VbScripting is not enabled on your machine, disabled there in Registry, especially on Windows 10. You have to enable there.
Though VbScript is enabled and you can run scripts directly from a file in a Folder like sample.vbs, script may not run on Outlook Custom Form if Outlook application has security setup in Registry Key when installed.
I faced this problem and solved after several attempts.

Why and how to fix? IIS Express "The specified port is in use"

We know a random port number is assigned to a web application in Visual Studio. It works fine in my office desktop. But when I pull the code onto my laptop (from VisualStudio.com) and run the web app. I got a message, saying,
The specified port is in use
Port 10360 is already being used by another application.
Recommendations
Try switching to port other than 10360 and higher than 1024.
Stop the application that is using port 10360.
I can fix it using Recommendation #1 by changing the port into something else like 13333. But I am very curious what happened to port 10360. How can I check what application is using port 10360? How can I stop that application?
I had a similar issue running Visual Studio 2019 on Windows 10.
Some solutions that worked for others seemed to include:
Changing the application port number.
Have Visual studio automatically assign a port number each time the application start.
Restart Visual Studio
Restart the computer.
Unfortunately, none of these solutions worked for me, assigning another port number did work but was not an acceptable solution as it was important for my application to run on a specified port.
The Solution
First I ran the command:
netsh http add iplisten ipaddress=::
from an elevated command-line process. This solved the initial error, when attempting to run the application I no longer got the "port in use" error, instead, I now got an error stating the application was unable to bind to the port because administrative privileges were required. (although I was running Visual Studio as administrator)
The second error was caused by Hyper-V that adds ports to the Port Exclusion Range, the port my application uses was in one of these exclusion ranges.
You can view these ports by running the following command: netsh interface ipv4 show excludedportrange protocol=tcp
To solve this second error:
Disable Hyper-V: Control Panel-> Programs and Features-> Turn Windows features on or off. Untick Hyper-V
Restart the computer.
Add the port you are using to the port exclusion range: netsh int ipv4 add excludedportrange protocol=tcp startport=50403 numberofports=1 store=persistent
Reenable Hyper-V
Restart the computer
From here everything worked perfectly.
i solve the problem this way...
File -> Open -> Web Site...
After that select Local IIS under IIS Express Site
remove the unwanted project.
hope this help.
change it in solution (right Click) -> property -> web tab
Click Create Virtual Directory (in front of project Url textbox)
This was haunting me for over a year!
For me,
no website was running iin IIS Express
nothing was using the port as determined by running: netstat -ano at the command line.
The solution was to run
netsh http add iplisten ipaddress=::
from the command line.
Happy days, and credit to: James Bryant! https://developercommunity.visualstudio.com/content/problem/110767/specified-port-is-in-use.html
SIMPLE SOLUTION THAT WORKED FOR ME: (Credits to combination of other's answers)
**My System Info:**
Windows 10 build : 1809
IIS Version : 10.0.17763.1
Hyper-V : Enabled
Docker : Installed - 2.3.0.2 (45183)
Check for blocked ports range in CMD (admin)
>> netsh interface ipv4 show excludedportrange protocol=tcp
(Sample output):
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
49696 49795 (SEE HERE, 49796 to 49895 is not blocked)
49896 49995
... list goes on ...
Open Visual Studio and Navigate to > Project > Properties > Web > Servers > Project Url
Use the Port that is not blocked.
(Sample port):
http://localhost:49796/
Restart Visual Studio (if required)
Have a coffee and share love. (required) :)
I had the same problem, but no proccess appeared neither in netstat nor in resmon.
What solved the problem for me was closing all the open browser windows.
You're looking for netstat.
Open an administrative command shell and run
netstat -aob
And look for port 10360. It'll show you what executable opened the port and what PID to look up in Task Manager. (Actually, run netstat -? in an unprivileged shell first, because I don't approve of blindly running anything you don't understand, especially in a privileged context.)
Here's what the switches do:
-a shows all connections or open ports, not just active ones - the port you want is probably listening, not active.
-o shows the owning PID of the connection or port, so you can find the process in Task Manager's Processes tab. (You might need to add the PID column in Task Manager. View->Select Columns)
-b shows the binary involved in opening the connection or port. This is the one that requires elevated access.
The cause of this issue in my own case is a bit different. Everything was working fine until I started docker to do some other stuff. Starting docker, in one way or the other, added some new ranges of ports to the Port Exclusion Ranges. What to do:
Open command prompt (As an administrator)
run: netsh interface ipv4 show excludedportrange protocol=tcp (You should see the port your application is using in the excluded port ranges)
run: net stop winnat
run: netsh interface ipv4 show excludedportrange protocol=tcp (by this time, the Administered port exclusions ranges should reduce)
run net start winnat.
If the problem was caused by Windows NAT Driver (winnat), then you should be good by now.
Close the VS
Start again - right click and run as admin
Run your project again.
Running visual studio in administrative mode solved my issue
Delete the .sln file, if you have one.
Open the file C:\Users\NN\Documents\IISExpress\config\applicationhost.config
Locate the problematic site in configuration/system.applicationHost/sites and delete the whole site section.
"Open Web Site.." from Visual Studio and the project will be given a random new port.
For me the "The specified port is in use" error is usually fixed (well actually worked arround) by stopping the "Internet Connection Sharing (ICS)" (SharedAccess) and the "World Wide Web Publishing Service" (W3SVC) service.
After the project / ISS Express is started the stopped services can be started again without issues.
Whenever i receive the error the port (in the 50000 range) is definitely not in use (checked with netstat & tcpview).
It would be nice if Microsoft did some integration testing of Visual Studio / IIS Express along side with HyperV and the "normal" IIS Service OR gave some guidance on which port ranges to use for VS / IIS Express (and which ports to avoid).
Visual studio 2015
Close all the files you have open inside Visual studio.
Then close application and exit Visual Studio.
Open Visual Studio and it should successfully run.
I hope this helps.
netstat didn't show anything already using the port
netstat -ano | findstr <your port number> showed nothing for me. I found out that port was excluded using this command to see what ranges are reserved by something else:
netsh interface ipv4 show excludedportrange protocol=tcp
You can try to unblock the range from the start port for a number of ports (need Command Prompt with Administrator):
netsh int ip delete excludedportrange protocol=tcp numberofports=<number of ports> startport=<start port>
However, in my case I couldn't unblock the range, I just got "Access is denied", so I ended up having to pick another port for my site.
My original solution: The only thing that worked was deleting the .vs folder in the solution folder. (I've since found you can just delete the .vs/config/applicationhost.config instead to avoid losing so many settings).
If netstat doesn't show anything, try a reboot.
For me, nothing appeared in netstat for my port. I tried closing Google Chrome browser windows as #Clangon and #J.T. Taylor suggested, but to no avail.
In the end a system reboot worked, however, so I can only assume that something else was secretly holding the port open. Or perhaps it just took longer than I was prepared to wait for the ports to be released after Chrome shut down.
For me, close all application and restart the computer.
When window start, Open Visual studio first, then open browser and click run(F5).
Now it works. I don't know why.
Open Task Manager and Just Close all processes of 'IIS Express System Tray' and 'IIS Express Worker Process' and Re-run the Project
For me, the Google Chrome browser was the process which was using the port. Even after I closed Chrome, I found that the process still persisted (I allow Chrome to "run in background" so that I can receive desktop notifications). I went into Task Manager, and killed the Chrome browser process, and then started my web application, it worked like a charm.
Open your csproj with for example Notepad ++ and scroll down to DevelopmentServerPort. Change it to something else as long as it's above 1024 like rekommended (so for example 22312). Also change the IISUrl to http://localhost:22312/. Save your changes and restart the project.
In my case there was no application using specified port and elevated running of Visual Studio didn't help either.
What worked for me is to reinstall IIS Express and than restart computer.
For me it was an orphaned VBCSCompiler task from a previous run, that didn't shut down and was somehow interfering. Killing that task solved it.
https://developercommunity.visualstudio.com/content/problem/31482/vbcscompiler-does-not-shut-down.html
You need to configre this parameter by running the following in the administrative command prompt:
netsh http add iplisten ipaddress=::
click on the notification present on bottom of the task bar if you receiving the error like port in use then select the iiss icon right click then click on exit ,it work like charm for me
I had same error showing up. I had my web service set as an application in IIS and I fixed it by:
Right-click on my WebService project inside my solution > Properties > Web > Under 'Servers' change from IIS Express to Local IIS (it will automatically create a Virtual Directory which is what you want)
When Port xxxx is already being used, there's always a PID (Process Id) elaborated with the error. Simply go to the task manager on the machine you are running the application, click on details, and you will identify what the other application is. You can then decide whether you want to end that process or not
Just to add to this, I had the full IIS feature turned on for one of my machines and it seemed to cause this to happen intermittently.
I also got random complaints about needing Admin rights to bind sites after a while, I assume that somehow it was looking at the full IIS config (Which does require admin as it's not a per-user file).
If you are stuck and nothing else is helping (and you don't want to just choose another port) then check you have removed this if it is present.
FWIW, I tried tons of these options and I didn't get anywhere. Then I realized I had installed VMWare Player just before the issue started. I uninstalled it, and this error went away.
I'm sure there's some way to make them coexist, but I don't really need Player so I just removed it. If you've tried all kinds of stuff and it's not working consider looking through any programs you've installed recently (especially those that deal with network adapters?) and see if that gets you anywhere.
In Visual Studio 2017, select Project/Properties and then select the Web option. In the IIS section next to the default project URL click Create Virtual Directory. This solved the problem for me. I think in my case the default project Virtual Directory had been corrupted in some way following a debugging session.
For me only thing worked is removing the element containing my application name, path and binding info under
</system.applicationHost> element in
applicationhost file.
To be found under C:\Users\yourUsername\Documents\IISExpress\config
Closed the the solution , deleted the bad site element , save the applicationhost file and close.
Reopen the application/Website from Visual studio using Admin rights - Rebuilt and Run. Voila... A new port is auto assigned to your application which solves the purpose.
Can also be verified without running-- check the Properties window for the solution and URL will have new port number.
In my case I got also this issue from my ASP Core 3.1 projets.
I thing that for some reason visual studio ignore the IP/Port setting in the project property and start it on 5000 and 5001. I discovered this while attempting to start my Core 3.1 projects from prompt using dotnet run
And this post helped me
How to specify the port an ASP.NET Core application is hosted on?
It suggest to
Specify the port in the appsettings.json or maybe appsettings.development.json. (see lower)
Close Visual Studio
Delete /.vs, /bin, /obj folders
Restart Visual Studio.
appsettings.json / appsettings.development.json content
{
/***************************
"Urls": "http://localhost:49438", <==== HERE
/***************************/
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"connectionStrings": { ... }
}

Where in the registry can I find the current setting of an IE8 policy?

I have set the following policy with gpedit in a Windows Server 2008 machine that has IE8:
I have a source that tells me that configuration resides in HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Internet Explorer\Restrictions\NoExtensionManagement -- but that's a lie. There isn't even an Internet Explorer folder under Software\Policies\Microsoft.
Moreover, the same source says the setting is under "Computer Configuration\Network\Internet Explorer\Do Not Allow Users to enable or Disable Add-Ons" on gpedit. As you see above, that isn't true either.
OK, the "source" I'm talking about is the US Government: http://usgcb.nist.gov/usgcb/download_ie8.html -- namely, their IE8 OVAL definitions.
So, where in the registry is that setting?
It is an either/or. The policy can be implemented via the registry OR the GPO. You'll find your GPO where it is set in something like:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{71DA9274-FD7B-4660-A801-B013570D3F5F}Machine\Software\Policies\Microsoft\Internet Explorer\Restrictions
or
HKEY_USERS\S-1-5-21-2090352725-1269969352-1905203885-2959\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{71DA9274-FD7B-4660-A801-B013570D3F5F}Machine\Software\Policies\Microsoft\Internet Explorer\Restrictions
though the GPO itself is stored on disk, and not the registry ... I think here:
%systemroot%\System32\GroupPolicy
As far as where you'll find various settings in gpedit - it does depend on your version of windows.
After getting hit with some unwanted intrusive piece of software, I couldn't reset the IE8 settings on my Windows XP machine (yes, I know how old that is). Found the problem - the "Control Panel" settings had an additional registry entry in HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
The zonemap under this registry key had 1803 disabled. That made three different entries for the same value in the registry. It wasn't IE8, it wasn't Group Policies. It was a rogue copy hidden in the HKLM that overrode other settings.
Symptom included that message "some settings controlled by Group Policy ..." Well, who's the group, exactly, on my tablet.
The Microsoft KB182569 is excellent. The only missing data was where to find the "unwanted" copy of zones.

Resources