use appcmd how to delete many applications - appcmd

I have known that using appcmd delete one app, for examle:
C:\Windows\System32\inetsrv\appcmd.ext delete app "sitename/appname"
but I want know use this command how to delete 2 or 3 applications?

I search and find that you can only delete one application by appcmd command once time .
the usage of appcmd command is as follows:
APPCMD delete APP [identifier] [-parameter1:value1 ...]
identifier : need to delete application url

Related

How to Transfer Umbraco CMS from One PC to Another

I am newbie with Umbraco.
I get the source code copy from my Vendor. I want to run UmbracoCMS on my local Development PC.
I changed connectionstring and point to database which provided by vendor.
When I run the UmbracoCMS it gives me this error. How to fix this? Which settings do I need to make to run on my local system?
Error:
e.Fields["umbracoFileName"] = Path.GetFileName(e.Fields["umbracoFile"]);
Try republishing all your nodes by visiting
http://YOURDOMAIN/Umbraco/dialogs/republish.aspx?previews=true
and also chack the the /media/ folders exists and all the permission for the user that runs the app pool are set right

How to Specify the Target App when setting up PredictionIO for Rails App

I'm new to PredictionIO, and I'm following this tutorial http://docs.prediction.io/0.8.0/tutorials/engines/itemrec/rails.html. I got to the step where I need to import a rake task. Well, that doesn't work and I get this error:
PredictionIO::EventClient::NotCreatedError: The requested resource could not be found.
That happens when I try this line:
client.set_user(user.id)
Now, right before this step, it says to change file params/datasource.json and to specify the target app. I don't know how to get this ID and I suspect this might be the problem here.
Hope this is clear and someone knows the answer.
Select a unique number for your application,say 5.
Replace PIO_APP_ID with 5 in the rails code and run.This is to inform the event server that incoming events are pertaining to appId=5.
Once all the events are registered, go to io.prediction.engines.itemrec/params/datasource.json and change appId to 5.Now train,deploy the engine in that order.
You can view the events registered by the event server by
curl -i -X GET http://localhost:7070/events.json?appId=5

using NSIS to install and run every time

Im doing a little research into installers, and right now at my company we are having some issues deploying from jenkins using click once. We have a test certificate(these programs are all internal) and for some reason are having some issues with the certifcate being incompatiable with certain msbuilds/.net frameworks. So im looking into alternatives.
But in that i want to keep the same architecture. How it works right now is someone clicks on a button in our task bar, clicks on the application they want, and then click once installs the updates(or installs) without further user input and starts the application. Ive heard a lot of good things about NSIS.
So far ive only seen generic application installers like you expect when you download anything from the internet. Could I do something like i described above using NSIS?
A very basic no interaction installer might look like this:
Name foo
OutFile foo_setup.exe
AutoCloseWindow true
RequestExecutionLevel user
InstallDir "$LocalAppData\Programs\MyApp"
Page InstFiles
Section
SetOutPath "$InstDir"
WriteUninstaller "$InstDir\uninst.exe"
; TODO: Add registry entry for Add/Remove Programs
File "MyApp.exe"
File "Data.xml" ; Support files etc
Exec '"$InstDir\MyApp.exe" -firstrun "c:\some path\file.ext"'
SectionEnd
Section Uninstall
Delete "$InstDir\MyApp.exe"
Delete "$InstDir\Data.xml"
Delete "$InstDir\uninst.exe"
RMDir "$InstDir"
SectionEnd
If you want to install for all users in %ProgramFiles% you can run into issues with Exec because the app can end up running as the wrong user if a non-administrator used some other account in the UAC dialog.

Updating EXE file from server…

I need to update my application from a central server.
The application checks always if it is a correct version, against the server installation.
So when it is not, I need it to update itself.
So how can I copy the EXE if it is running? What solution do I have?
I rename the current running exe to MyTempExe.exe, copy the new exe to the correct location (request elevated privileges if necessary) and then run a separate app to restart the main app. On start up I check for MyTempExe.exe delete it if it's there.
The reason I use a separate app for the restart is I don't have a set time frame for the app to close down and need to wait for it to finish whatever it's doing, on shutdown it writes information to disk about its current state that the updated app will use to resume where the old one left off.
I don't know if it's the best solution but it's the one I use.
As you can see by all the answers there is no set way to do this, so I thought I would add the way we have successfully done this.
We never run an application directly from the network.
We run the application from the local machine and have it copy from the network on startup.
We do this using an application launcher. It downloads an XML file that contains CRC and Version Resource Values for the application files. The XML File is created during the deployment process, in a FinalBuilder Script.
The application then compares the XML File to local content, and copies down needed files. Finally we then launch the application in question. This has worked well for deploying an application that serves around 300 local users. Recently we switch from a file copy to an HTTP download as we found problems with remote user disconnecting drives.
We still still build installations (With Innosetup) to get the basic required files deployed.
Package your app with an installer such as Inno. Download and execute the installer. Have the installer search for and kill your app, or instruct the user to close it. The setup will replace your .exe, and if the app can't be killed or the user is non-cooperative, it'll issue a re-start notice.
Download new EXE to TEMP
Create Batch from EXE, content:
taskkill /PID %process id of running EXE%
copy %new EXE% %running EXE%
%EXE%
all values in %...% are placeholders
execute batch from the running EXE
delete batch
I use TMS TWebUpdate myself, for software updates. The advantage is that there a bunch of extra actions you can put into the script, if you need anything other than plain EXE updates.
I have two components at work the application executable itself and a web-service (SOAP) which provides version details and file downloads.
The application calls a method on the SOAP service to ask for the number of files in the project (project is identified by using the application.exename usually).
The soap service gets its info from an INI file, which has entries like:
[ProjectName]
NumberOfFiles=2
File1=myapp.exe;1.0.0.1
File2=mydll.dll;1.0.0.2
You just update this file at the same time as uploading your new files.
The process of updating the application this:
Get number of files available on the web service
For each file, the application asks for the name and version number from the SOAP server.
The application compares this information to its own version info and decides if the file needs updating, building a local list of files that need updating.
For each file that needs updating the application downloads the file to filename.ext.new
Finally, the application renames all filename.ext to filename.ext.old and renames filename.ext.new to filename.ext and then restarts itself. (No real need for an external app to restart your own program).
Note 1, that you may have to ask for elevation to replace files, depending on where you install your files.
Note 2: be kind to your users, think carefully before you force updates on users.
Note 3: You cannot delete a running exe, but you can rename it and then restart the new version.
Edit===
For some reference data files which cannot contain version information resources, you can have entires like File99=MyDataFile;1.1.2011 the 3 elements to the version number indicates to the client that it should check against the file date/stamp.
You could have a separate update executable whose task is to check the server version, download an updated executable if necessary, and then run the local executable.
Or you could have one executable running in two different modes: 1. on startup, check for an update, if there is one, download the executable to a download directory, run it and quit.
2. The new executable would check if it's running from the installation directory, if not, it would copy itself there, overwriting the old version, start the copy from there, and quit.
My way is the other way round: If a new version is online, promt the user to update. If he want's to (or is forced to...) I end the app and start a new exe (updater). this updater loads the update and replaces the old exe (not running). then it starts the new exe. ready. (You can of course replace other files too.) BUT: Using an Installer like InnoSetup gives you more possibilities and doesn't mix up with the regular uninstaller, so it is really better...
You can do this without running another application. Push the updates to the client from the server while running, storing in a temporary directory on the client. When you want to upgrade move all your running files to another temporary directory, move the new files into the original application directory, and just restart the application using the standard executable name on shutdown.
I upgrade client applications running on unattended machines automatically this way.

How do I delete a folder that another process has open?

I created two services. I want to delete a folder, but that folder is used by my first service. When I execute the first service after that I execute the second service it works fine. But when I try to execute both service at the same time it does not work properly.
Actually, the question should have been "What in the application could prevent folder from deletion by other applications".
Possibilities are:
Your service opens some file in that folder and does not close it. Check all files that you are opening in the service, and close the ones which are in that folder.
How files are closed depends on how they were opened. If you used CreateFile(), then close with CloseHandle(). If it was TFileStream, then just Destroy it.
Your service has that folder set as the current directory. Choose other directory as a current with SetCurrentDir.
you cannot delete it unless, you can tell the other service by sending message to stop using the folder(or its content) before deleting it.
If first service is launched before second service then you can delete folder but if both services are launched together then you can't delete folder.
Only difference is you allowed time for first service to finish working with the folder.
Things to consider:
If your first service is using the folder then you won't be able to delete it until your service closes connection with that folder like already mentioned.

Resources