Hello. I am trying to get the machine name in a Reporting Services 2000
report. I thought I would put this in the registry and read it from a
function in the custom code. Here is my first attempt:
Public Function GetMachineName
On Error Resume Next
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Return WshShell.RegRead("HKLM\Software\Something\MachineName")
End Function
This gives a build error: Let and set are no longer supported. OK, so I take
out the set on line 3. Then it says "WScript" is not declared. I'm pretty
sure this is valid code. I got it from Windows Script Host 2.0 Documentation.
Does Reporting Services support using the WScript functionality? Thanks in
advance.I tried to do the same thing with SRS 2005 and VS 2005 but I get the error
message listed below.
'Read reg key value
my.computer.registry.GetValue(myPath, "RegKeyName", Nothing)
Error: Unhandled exception: Request for permission of type
'System.Security.Permissions.RegistryPermission
To get around this, you can do one of two things:
1. Use "Reg Query" command to read the registry and set a variable to the
the computer name
2. Use an HTA front end which will use VBScript to read the machine name and
then use the /v to pass the machine name variable from either step above.
I have an HTA front end for this very same issue so send me an email if you
want a copy.
Hope this helps!
Rafael
"Justin30519" <Justin30519@.discussions.microsoft.com> wrote in message
news:81784CFA-B08F-4CCE-85F3-C855EE8CFC7D@.microsoft.com...
> Hello. I am trying to get the machine name in a Reporting Services 2000
> report. I thought I would put this in the registry and read it from a
> function in the custom code. Here is my first attempt:
> Public Function GetMachineName
> On Error Resume Next
> Dim WshShell
> Set WshShell = WScript.CreateObject("WScript.Shell")
> Return WshShell.RegRead("HKLM\Software\Something\MachineName")
> End Function
> This gives a build error: Let and set are no longer supported. OK, so I
> take
> out the set on line 3. Then it says "WScript" is not declared. I'm pretty
> sure this is valid code. I got it from Windows Script Host 2.0
> Documentation.
> Does Reporting Services support using the WScript functionality? Thanks in
> advance.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment