I am attempting to run the following Powershell command to remove a service application. The command never returns and just hangs and hangs. Anyone now why?
Remove-SPServiceApplication -Identity -RemoveData
SharePoint timer service was stopped causing the script to hang.
Related
I have a self hosted asp.net core app deployed and in use in an enterprise environment on Windows Server 2012.
I am looking for a way to automate the update process, I am currently doing this through a bat file but keep getting windows file lock errors where the file cannot be deleted. The process I am following in the bat file is as follows:
kill the dotnet core process for the web app
clear the directory (after sleep for a couple of seconds)
copy the updates over
restart the web app
I am getting the errors in 2 where I try to clear out the existing directory which still has file locks even though I have killed the process - "Cannot delete output file - access is denied".
My question is how can I upgrade the self contained asp.net core web app in place and avoid the file locks? If the site is offline for a few seconds it is not an issue.
Thanks
There a several reasons i can think of that deleting the directory gives access denied errors.
Your process isn't actually stopped yet. I know you can use powershell to await until porcess is stopped. (or check if process is stopped yet and otherwise wait 3 more seconds)
Another process still runs in this folder. (maybe even a command line, or explorer.exe is opened in the folder.)
You need admin rights to delete this folder.
The bat file you are executing executes from this directory, and itself is locking the directory.
Try one of the following:
powershell Stop-Service.
It should wait until service is really stopped.
powershell Wait-Process Waits untill process is stopped. you can call this directly after Stop-Process
Try to run powershell to wait like this for example (in commandline):
powershell -Command "Wait-Process -Name MyProcess"`
(warning you might run into ExecutionPolicy problems)
Tip
Use msdeploy, you can remote execute commands and deploy your application.
You can use pre and post scripts (to stop and start the app) and msdeploy it self will sync the folder/directory for you.
I have a simple (test) Powershell script, it creates an empty file. The script runs fine executed manually in Powershell. However it does nothing when executed in SSIS.
I've tried executing it in an Execute Process task and also in a VB.Net Script task.
Both times Poweshell seems to open (I see the screen come up and close quickly), however the file that the script tries to create doesn't get created.
Any ideas how to troubleshoot this would be appreciated!
Thank you!
Adding -ExecutionPolicy ByPass is what made it work. So now what I am passing is:
-ExecutionPolicy ByPass -file "\\SERVER\Share\Script.ps1"
This is where I got this tip - http://www.sqlservercentral.com/Forums/Topic1714552-147-1.aspx
After I added this, Read-Host started working also and paused the execution of the script.
Please someone help me!
Cannot run Multiple shell command in vb.net
when run the shell command in projects , the projects is hangs until command is finish.
And how to run without hangs in projects.
Thanks...
Sorry for Spelling.
Try using Process.Start() instead. It is only slightly different but is more powerful. By default it will not wait. But you can wait by getting the process it creates and then waiting on it to exit.
I have a Jython script that is meant to run as a daemon in background, but somehow it doesn't start at all when I'm trying to run it in background.
So I've tried to do a most basic "hello world" script, it works fine if I execute it in console like
./mysqript.py
But same script executed like
./mysqript.py &
fails. It doesn't output error messages, it doesn't throw exceptions, it's actually not even quitting silently. It's just hanging forever in the process list as a zombie process doing nothing.
Why is that and how can I make it work?
PS: Environment is Jython2.7 beta.
I am using MSBuild task to start a windows service. I am using following code:
MSBuild.ExtensionPack.Computer.WindowsService TaskAction="Start" ServiceName="AppServices" ContinueOnError='false'/>
If I start the service I am getting following error:
Start Service failed with return code '[7] ServiceRequestTimeout'
Is there any setting or option to tell MSBuild to start service after waiting for a minute or two. Or Is there any way to introduce delay before calling this task within MSBuild?
Thanks
I do not think there is a way to tell the actually WindowsService task to delay the command. You can try putting this before your call though though:
<MSBuild.ExtensionPack.Framework.Thread TaskAction="Sleep" Timeout="1000"/>
This will put the executing thread to sleep for the timeout specified (in milliseconds).