What is the pipe\srvsvc named pipe for - named-pipes

Watching WriteFile operations with Procmon I noticed that MPC-HC writes to \\MYSERVER\PIPE\srvsvc. What is the purpose of this named pipe on Windows Server 2012 R2 ? I read very detailed articles and did't understand. I need some big picture of that.

Related

robocopy error with ERROR 32 (0x00000020)

I have two drives A and B. Using a python script I am creating some files in "A" drive and I am running a powerscript which copies all the files in the drive A to drive B in the interval of 1 sec.
I am getting this error in my powershell.
2015/03/10 23:55:35 ERROR 32 (0x00000020) Time-Stamping Destination
File \x.x.x.x\share1\source\ Dummy_100.txt The process cannot access
the file because it is being used by another process. Waiting 30
seconds...
How will I overcome this error?
This happened is because the file is locked by running process. To fix this, download Process Explorer. Then use Find>Find Handle or DLL, find out which process locked this file. Use 'taskkill' to kill that process in commandline. You will be fine.
if you want to skip this files you can use /r:n that n is times of tries
for example /w:3 /r:5 will try 5 time every 3 seconds
How will I overcome this error?
If backup is, what you got in mind, and you encounter in-use files frequently, you look into Volume Shadow Copies (VSS), which allow to copy files despite them being ‘in use’. It's not a product, but a windows technology used by various backup tool.
Sadly, it's not built into robocopy, but can be used in conjunction with it. See
➝ https://superuser.com/a/602833/75914
and especially:
➝ https://github.com/candera/shadowspawn
It could be many reasons.
In my case, I was running a CMD script to copy from one server to another, a heap of SQL Server backups and transaction logs. I too had the same problem because it was trying to write into a log file that was supposedly opened by another process. It was not.
I ran many IP checks and Process ID checkers that I ran out of knowing what was hogging the log file. Event viewer said nothing.
I found out it was not even the log file that was being locked. I was able to delete it by logging into the server as a normal user with no admin privileges!
It was the backup files themselves by the SQL Server Agent. Like #Oseack said, there may have been the need to use another tool whilst the backup files themselves were still being used or locked by the SQL Server Agent.
The way I got around it was to force ROBOCOPY to wait.
/W:5
did it.

ETW File IO Monitoring on XP/2003

I've been investigating ETW for process/file/registry/network monitoring. It looks like it on Win7 it has everything I need. However, on XP it seems to be lacking the same level of detail. Specifcally, with file IO only "FileCreate" events seem to be logged and process creation events don't give a full path.
Is it possible to determine when a file is written to on XP with ETW? And how about the full path to a process start event?
Starting with Vista MS added a lot of ETW providers to Windows. XP/Server only had a few of them. So you can't fix this for XP.

Powershell: Find out if NUMA is configured and how many CPUs are assigned to each NUMA node?

Using Powershell, how can I find out if my server has NUMA enabled and how many CPUs are assigned to each NUMA node?
Update:
I found out here that the microsoft.sqlserver.management.smo.server object object has an affinityinfo field. However, that field doesn't exist in my server object in Powershell when I create it (SQL Server 2005 on Windows XP).
Update:
It appears that the affinityinfo field only exists in SQL Server 2008 R2 and later.
There are APIs available that will get you this information but they are unmanaged which means they are not easily callable from PowerShell (.NET). In order to call these directly you have to use the Add-Type cmdlet to compile C# code into an in-memory assembly which you would then instantiate or invoke a static method from. I have an example of what this looks like on my blog.
Writing the C# is the tricky part because there is a lot of unfriendly looking code associated with it, check out this example. If you are familiar with C#, you might be able to adapt this to what you want. If not Mark has a tool called Coreinfo that looks like it will get you the information you are looking for. It actually calls the same unmangaged API that the linked p/invoke code does (GetLogicalProcessorInformation). You can just call this from PowerShell and process its STDOUT.
I don't think that native OS APIs in Windows 7 and Windows Server 2008 R2 for working with more than 64 logical processors are available in .NET, you can have a look to .NET Support for More Than 64 Processors. This guy use to write a .NET wrapper for OS APIs, you perhaps use that in PowerShell.

Application Deployment with Powershell

I've developed a Powershell script to deploy updates to a suite of applications; including SQL Server database updates.
Next I need a way to execute these scripts on 100+ servers; without manually connecting to each server. "Powershell v2 with remoting" is not an option as it is still in CTP.
Powershell v1 with WinRM looks the most promising, but I can't get feedback from my scripts. The scripts execute, but I need to know about exceptions. The scripts create a log file, is there a way to send the contents of the log file back to the "client" (the local computer making the remote calls)?
Quick answer is No. Long version is, possible but will involve lots of hacks. I developed very similar deployment script/system using PowerShell 2 last year. The remoting feature is the primary reason we put up with the CTP status. PowerShell 1 with WinRM is flaky at best and as you said, no real feedback apart from ok or failed.
Alternative that I considered included using PsExec, which is very much non-standard and may be blocked by firewall. The other approach involves using system management tools such as MS's System Center, but that's just a big hammer for a tiny nail. So you have to pick your poison...
Just a comment on this: The easiest way to capture powershell output is to use the start-transcript cmdlet to pipe console output to a file. We have a small snippet at the start of all our script that sends a log file with the console output from each script to a central file share, and names the log file with script name and date executed so that we'll have an idea of what happened. Its not too hard to pipe all those log files into a database for further processing either. Probably won't seolve all your problems, but would definitely help on the "getting data back" part.
best regards,
Trond

Un-enlisting a BizTalk MSMQ send port in batch file

I've got a solution which I setup / cleanup using batch files ...
- there are a pair of MSMQ ports, send and receive, with another application on the end of the queues
I'm finding I can't properly stop the orchestration in the batch file ... the error is the send port is unenlisted
- I'm using the StopOrch.vbs script from the SDK samples
But I can go into BizTalk Admin Console and manually stop the orchestration with Full Terminate Ok
The setup / cleanup works Ok if I don't actually push any messages down the MSMQ queues
You might also take a look at the Microsoft.BizTalk.ExplorerOM.dll. It is contains business level objects that are pretty nice to interact with in .NET code. You can find the dll in the installation directory, mine is at: C:\Program Files (x86)\Microsoft BizTalk Server 2009\Developer Tools
Here is the MSDN documentation on it:
http://msdn.microsoft.com/en-us/library/microsoft.biztalk.explorerom(BTS.20).aspx
And a good high level walk through of its use:
http://geekswithblogs.net/claeyskurt/archive/2008/10/13/125815.aspx
Steve,
I would look at using a powershell script to handle terminating all the suspended messages and also shutdown the the orchestration the proper way. I believe there's a set of these scripts on codeplex if you search. Also look at the SDC MSBuilt components on complex for doing that as well.
-Bryan