How to take Windows and Data Backup Programmatically? - c#

I need to take backup of windows data and its settings using C# code.
In order to achieve the goal I am running the following command:
Wbadmin start backup
SOURCE of the command
Problem:
This command is not working with all versions of Windows.
Request
Is there any other reliable way to take windows data and settings backup.

Wbadmin works on:
Windows Vista
Windows Server 2008
Windows 7
Windows 8
Windows 10
Windows Server 2008 R2
Windows Server 2012
That's a pretty standard recommended solution. What are you running into issues with beyond that?

You should be able to use something like Scenario #2 from:
https://technet.microsoft.com/en-us/library/cc742083(v=ws.11).aspx
wbadmin start backup –backupTarget:d: -include:g\folder1,h:\folder2 –systemstate -vsscopy
It would also be a good idea to take note of the syntax section
Syntax for Windows Vista and Windows Server 2008:
wbadmin start backup
[-backupTarget:{<BackupTargetLocation> | <TargetNetworkShare>}]
[-include:<VolumesToInclude>]
[-allCritical]
[-noVerify]
[-user:<UserName>]
[-password:<Password>]
[-noinheritAcl]
[-vssFull]
[-quiet]
Syntax for Windows 7 and Windows Server 2008 R2 and later:
Wbadmin start backup
[-backupTarget:{<BackupTargetLocation> | <TargetNetworkShare>}]
[-include:<ItemsToInclude>]
[-nonRecurseInclude:<ItemsToInclude>]
[-exclude:<ItemsToExclude>]
[-nonRecurseExclude:<ItemsToExclude>]
[-allCritical]
[-systemState]
[-noVerify]
[-user:<UserName>]
[-password:<Password>]
[-noInheritAcl]
[-vssFull | -vssCopy]
[-quiet]
You might have to detect the OS and run wbadmin start systemstatebackup in some scenarios. As you might notice, the systemState flag is missing from Windows Vista and Windows Server 2008. It's also important to note that wbadmin start systemstatebackup does not work on Windows 10, you will be greeted with the following message:
Warning: The DELETE SYSTEMSTATEBACKUP command is not supported in this version of Windows.
The operation ended before completion.

Related

Develop for Windows CE 6 on Windows 7

I'm trying to develop an application for a Windows CE 6 device. I'm using Visual Studio 2008 on Windows 7 and am able to create a Smart Device application, but when I try run it to see if it works, I get:
Error 1 ActiveSync bootstrap initialization failed. Please connect/cradle a real device or download the User-level Windows Mobile Device Center Application from http://go.microsoft.com/fwlink?linkid=67763 Device Connectivity Component
Following the link just takes me to the Windows Mobile site and I can't connect the actual device as I don't have the right cable. I already have Windows Mobile Device Center on my PC anyway.
Please help, I really need to get this sorted as I am nearing a deadline!!
Edit
Otherwise, would a Pocket PC application work on a Windows CE device?
I do a lot of development using CE 6.0 target devices and a 64-bit development PC, so it's definitely supported. How are you connecting to the device? WMDC is not needed (and if the target has any sort of ethernet, I'd highly recommend avoiding WMDC at all costs). You should be running ConManClient2.exe and then CMAccept.exe over on the CE device and connecting that way.

How to programmatically tell the difference between XP 64 bit and Server 2003 64 Bit

I have a program where I need to display a different link to a different download based on what version of windows a user is running.
Using this answer I am able to detect which version the OS is. Also using this answer I can detect if I am running on a 32 bit or 64 bit version of the OS.
This would suit my needs perfectly, however I came across this page which states that both Windows XP 64-Bit Edition and Windows Server 2003 use the version number 5.2.
How do I detect the difference between those two OS's?
As a side note, I do need to send them to a different location if they are on 2003 64 bit or on XP 64 bit, here are the links I am needing to send people to:
Remote Desktop Connection (Terminal Services Client 6.1) for Windows XP
Remote Desktop Connection (Terminal Services Client 6.0) for Windows XP x64 Edition
Remote Desktop Connection (Terminal Services Client 6.0) for Windows Server 2003
Remote Desktop Connection (Terminal Services Client 6.0) for Windows Server 2003 x64 Edition
GetVersionEx will set wProductType to VER_NT_SERVER for Windows Server 2003/2008/2008R2/2012, versus VER_NT_WORKSTATION for Windows XP/7/8.
You already know how to get whether the OS is 32-bit or 64-bit, so with a bit of P/Invoke (GetVersionEx is here), you should be able to figure out the rest.
Alternatively, if you don't want to use P/Invoke, you could use WMI, and take a look at the Win32_OperatingSystem class, which has the same information in the ProductType property. I wouldn't bother doing it this way unless you really had to.
Assuming you're programming in .Net:
http://msdn.microsoft.com/en-us/library/b3022k9x.aspx
System.Environment properties include:
Is64BitOperatingSystem
Is64BitProcess
OSVersion
ProcessorCount
Etc etc

Setting Up a SharePoint Developer Virtual Machine

I am new to sharepoint 2010 development and need help setting up the dev environment (virtual machine setup).
I have a new Windows 7 laptop (64bit and 4gb ram).
I have downloaded the vhd files (2010-10a.part01.exe etc) from the microsoft website.
I am unsure as to what the next step is. Do i need to install windows server 2008 r2 next? Will this work on laptop?
What i am asking is do i need to install 'windows server 2008 r2' on my laptop
Here is an alternative guide we used to install a SharePoint 2010 development environment, it can even be done on Windows 7 if you wish...
http://msdn.microsoft.com/en-us/library/ee554869.aspx
(We just use our company AD for user handling in our development environments, not best practice I guess, but starting with SharePoint is a monster hassle IMO, so going for the simplest solution to get started first is my recommendation)
You will wan't more RAM for a VM developer setup. Personally I use 8GB+ of memory (and SSD's) for the Developer VM's I have running.
Obviously a Virtual Environment can be very desired for SharePoint development (rolling back etc.). So going with a VM ain't a bad choice, your machine just won't handle it very well as is now...
A few things:
First, the virtual images they reference and are talking about require sever 2008 hyper-V. So you can scratch the use of these images on your laptop. (unless you blow out your existing OS, and install hyper-V on it, and the windows + windows server 2008 on top of of hyper-v). Windows 8 will have some versions that come with hyper-v, but let's not go down that road as of yet.
Next up, is at noted, these server based systems need quite a bit of ram. To run a WHOLE SharePoint server is REALLY quite large of a system. This system has to SQL server, has to run the web server, and THEN has an amazing number of additional services that need to startup and run such as workflows, Excel services, Access Services, indexing services and several web servers such as the admin site. – and this is the short list!
You need a min of 4 gigs of ram to just setup + install + setup SharePoint 2010. In fact, the min requirement is stated as 8 gig, but it will run quite nice in 4 gigs for testing.
Next up, as noted you cannot use the free edition of Virtual PC on your laptop to run such a virtual system such as 2008 r2 since VPC ONLY supports x32 bit operating systems as guests and you need a x64 bit VM here to run server 2008 of which then SharePoint runs on top of.
Assuming you bump your laptop up to 8 gigs, then you can most certainly grab something free like Oracle/Suns Virtual box and it does support x64 systems. And this setup will then run SharePoint 2010, but you cannot use those supplied images since they are not compatible with v-box (Not looked, but v-box does have support for VHD images from VPC, and they often also have additional images.
There might be some conversion utility, but that's another question.
So, unless you have 8 gigs, and unless you running hyper-V (server 2008) as your host system, then you cannot use such a VM setup on your laptop.
With more ram, you would have to install + setup hyper-V on your laptop.
With your current setup, you could consider to install + setup SharePoint on your laptop, but such a massive install would forever cause so many changes to your laptop that I would not being to consider such a setup on a dev box anyway. And again, you cannot use those VM images for such a setup + install on your laptop if you choose to NOT use VM technology as is being suggested with this idea.
And to be fair, you would never un-tangle the mess of systems that such a large server system with a GAZILLION services etc. that is installed anyway. In other words, I would build a box from the computer graveyard and use that!
So these VM's are not setup for your laptop environment you have. A longer shot would be if you had 8 gigs, and the disk vm images could be used with something like v-box (since it supports x64 VM's and you need this ability).
You need more hardware here regardless, and using the above images suggests that you have to install hyper-v on your laptop.
If you take a look at this website, In the overview it states that virtualmachine A is the windows 2008 R2 installation with sharepoint already on it.
B is a win2008 R2 with exchange
and C is 2008 with lync on it installed.
But i think you will need to have at least 8GB of ram for this to perform...
I don't know what processor you have but it has to be an I7 2nd or 3rd gen at least.
I tried the VM setup with only 4GB of RAM one time, it was terrible. I echo the other statements, you need a beefy PC to go that route.
I would reiterate many of what people have said about the 8GB of RAM. This thread explains other option for running the download you already have
https://sharepoint.stackexchange.com/questions/10461/sharepoint-2010-vhd-for-vmware
You can also try Cloudshare service for 14 days. It is a full featured Sharepoint server environment which you can access through RDC.

Unable to access HKLM\SOFTWARE sub keys on Win7

I'm writing this program that will need to access the registry to pull some info on the machine. It should always be run by someone in the Local Admin group, and it will be used on Server 2003 and 2008 machines. Basically it's been working fine for the most part on the box that I'm mainly writing it on, as well as my test 2003 and 2008 servers. The problem is, when I get on my laptop, which is running Windows 7, I cannot seem to use it for testing as I'm getting errors when trying to read or write the registry below HKEY_LOCAL_MACHINE\SOFTWARE.
I'm logged in as a user who is a local admin, and I can run Regedit to create a key, such as test9999. If I use the following it will always come back null.
RegistryKey testKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\test9999");
I've tried dropping the subkey and SOFTWARE will return, but I haven't been able to get anything below that.
I'm using MS VC# Express and I've tried running it "as Administrator" as well as trying to run the .exe's the same way, but it still continues to return null for anything below Software. What am I missing?
Turns out registry redirection behavior for 32 bit processes running on 64 bit Windows was changed in Windows 7 and Windows 2008 R2, which may explain why it works on Windows 2008 (not R2 I assume) and not on Windows 7.
Read more about it here: http://msdn.microsoft.com/en-us/library/aa384232(v=vs.85).aspx

Does the SQL connection string differ between Windows OS's?

I have done a small c# windows application. From that, I open a sql port from my SQL Server and I use it to access my server. When the application runs on XP it's working fine.
But when I want to run it on Windows 7 it's not running... do I have to do anything special in Windows 7? Suppose my SQL port is 1868... what should I have to do with that Windows 7 machine?
Thanks for ideas...
My connection string..
Data Source=192.158.2.70,1868;initial Catalog=Accounts;User Id=janani;Password=abcd"
have you checked your firewall settings?
http://msdn.microsoft.com/en-us/library/ms175043.aspx

Categories