COMPUTERNAME through .NET Interop
Luc_VanDyck
Member, Moderator, Administrator Posts: 3,633
When the environment-variable "COMPUTERNAME" is retrieved using 'Windows Script Host Object Model'.WshShell, the warning "The server has requested to run Windows Script Host Shell Object on your client." is displayed.
If "COMPUTERNAME" is retrieved through .NET Interop, does this still issues a warning?
How does the .NET Interop code looks like, to retrieve this variable, using NAV 2009 R2?
If "COMPUTERNAME" is retrieved through .NET Interop, does this still issues a warning?
How does the .NET Interop code looks like, to retrieve this variable, using NAV 2009 R2?
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
0
Answers
-
Do you need the computername of the Service Tier or the Client?
If you need it for the client, the warning still apears, at least if you don't change your ClientUserSettings.
If you want the service tier name (you don't run the code on the server) then no user validation is required.
There are serveral ways to do this. You can evaluate a Environment Variable text by using this method:
http://msdn.microsoft.com/en-us/library/system.environment.expandenvironmentvariables.aspx
Or you use "system.environment.machinename":
http://msdn.microsoft.com/en-us/library/system.environment.machinename.aspx0 -
I need to retrieve the client's COMPUTERNAME.
If the warning still appears when using Interop code, then I stick with Automation. What setting can be modified in ClientUserSettings.config to avoid this warning?No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Hi Luc Van DyckLuc Van Dyck wrote:I need to retrieve the client's COMPUTERNAME.
If the warning still appears when using Interop code, then I stick with Automation. What setting can be modified in ClientUserSettings.config to avoid this warning?
Please check at this post
http://mibuso.com/forum/viewtopic.php?f=32&t=56039
http://www.mibuso.com/forum/viewtopic.php?f=23&t=48217
Regards,
YukonMake Simple & Easy0 -
Thank you allNo support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
If someone is still interested how the .Net code look likes in C/AL here is an example
EXIT(SysEnv.GetEnvironmentVariable(property));
where property is text for e.g can 'COMPUTERNAME'
and SysEnv is variable of type DotNet and subtype
System.Environment.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'Regards,
Jerome Cader0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 323 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions