I'm trying to use PSTools to set the .Net version of a web site. My script builds a folder, creates an IIS Virtual Directory from that folder, copies a standard test file (not .Net) into the folder, then runs PSTools to register the site as .Net 2.0. The PSTools step fails. The script is attached. Hopefully the script and log files are attached as zip files.
Web20Log.zip (33.242 KB)Web20script.zip (3.474 KB)Hi Richard,
Here’s the error (for other people’s benefit).
> PsExec could not start C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -s W3SVC/1/ROOT/EmailHeirarchy on ad1hfdadm902:
> Return code : 3
According to MSDN, a return code of 3 means that the path can’t be found.
http://msdn2.microsoft.com/en-us/library/ms681382.aspx
hope that helps…
How do I determine the correct path relative to W3SVC? I know the file path (E:\web\EmailHeirarchy), but I don’t know how to determine the path as coded above. I just copied that from another script that worked but it was from a different server with a different virtual directory name.
According to the IIS Metabase Explorer the app root is /LM/W3SVC/1/Root/EmailHeirarchy. I tried that and the command failed. That confirmed to me that the original /W3SVC/1/Root/EmailHeirarchy might have been correct so I retried that and the command failed.
Any suggestions?
Hi Richard,
The return code of 3 suggests that the path to aspnet_regiis.exe is incorrect. Which operating system are you running on the remote machine and which version of the .Net framework are you trying to register?
As a test, run “C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe” at a command prompt on the remote machine to see if the path exists.
Regards,
Paul.
Here’s the output from running the command with -LK to list the Virtual Directories registered:
W3SVC/1.1.4322.2407
W3SVC/1/ROOT/1.1.4322.2407
W3SVC/1/ROOT/DirectoryLookup/2.0.50727.0
W3SVC/1/ROOT/ERABS/1.1.4322.2407
W3SVC/1/ROOT/HTSCBA/Artifacts/1.1.4322.2407
W3SVC/1/ROOT/HTSCBA/Lessons/1.1.4322.2407
W3SVC/1/ROOT/VendorBadgeRequest/2.0.50727.0
W3SVC/1/ROOT/EmailHeirarchy/2.0.50727.0
THe original command run was :
C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -s W3SVC/1/ROOT/EmailHeirarchy
so it should have worked, unless the trailling “/” is required.
The vdir is set to 2.0 because I set it manually via IIS manager on the server.
I created a new site: Test20fix. I tried:
C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -s W3SVC/1/ROOT/Test20fix
C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -s /W3SVC/1/ROOT/Test20fix
C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -s /W3SVC/1/ROOT/Test20fix/
C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -s W3SVC/1/ROOT/Test20fix/
via PSTools and none of them worked.
I ran C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe -s W3SVC/1/ROOT/Test20fix directly on the server and it worked.
Is there something wrong with my PSTools config to execute on the remote server? The server name is correct and I left the credentials blank to use the current credentials which are the same I use to login to the server console…
This is a buy/no buy decision and getting this script to work is the critical point.
Hi Richard,
Sorry I didn’t pick up on this earlier, you will need to put the command parameters in the ‘Parameters’ field of the action, not in the ‘Program File’ field.
So the action properties should be:
Program File: C:\Windows\Microsoft.Net\Framework\v2.0.50727\aspnet_regiis.exe
Parameters: -s W3SVC/1/ROOT/Test20Fix
Start In: C:\Windows\Microsoft.Net\Framework\v2.0.50727
Regards,
Paul.