Guess my idea to just write a program to disable win10 upgrades was not a good idea.
Just FYI, the 2nd key is what the group policy does from what I read.
I can't access the LocalMachine Key, I just get a null back.
I did the click run as administrator.
Logged in as administrator.
I really don't want to manually adjust every computer in the office.
Guess Microsoft really tightened up the security which is good.
bool pValue = false;
conststring subKey1 = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade";
conststring keyName1 = "AllowOSUpgrade";
conststring keyName2 = "DisableOSUpgrade";
using (var _key = Registry.LocalMachine.OpenSubKey(subKey1, true))
// Set the value for AllowOSUpgrade to false or Dword 0
_key.SetValue(keyName1, 0, RegistryValueKind.DWord);
_key.SetValue(keyName2, 1, RegistryValueKind.DWord);
pValue = true;
catch (Exception ex)
pValue = false;
if (ex.Message == "Attempted to perform an unauthorized operation.")
Console.WriteLine("You must be an adminsitrator to perform this task!");
Console.WriteLine("Right Click on the program and select 'Run as Administrator'");
Console.WriteLine("Press any key to exit");
Console.WriteLine("ERROR: " + ex.Message);
I didn't know that Any CPU had 2 different views of the registry, and calling programs like DSIM.
So I got that part working now for file execution and registry, but even elevating the UAC didn't allow me to edit that value and add a key.
This works great, for all the grids that the edit control showing event is subscribed too, but while tracing another problem I have noticed that when I am getting the row out of the combo box's datasource which is a bindinglist and reading the information to pass back to the database. with the following simplified event below. Each property that I read then fires the selected index event of the combobox.
privatevoid dg_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
DataGridView dgB = sender as DataGridView;
if (dgB.CurrentRow.IsNewRow == true)
LogManager.Instance.Logger("Policy SI").Info("New Row ");
if (e.ColumnIndex == 0)
LogManager.Instance.Logger("Policy SI").Info("Validating Col 1");
string newDescription = string.Empty;
newDescription = e.FormattedValue.ToString();
quoteTemplate = valuablesBinding.FirstOrDefault(p => p.Description == originalDescription || p.Description == policySumInsured.Description);
//Attempted here to deepclone the object from the valuables bindinglist//quoteTemplate = quoteTemplateNewDescription.DeepClone(); //Here with these 3 lines it will then fire the selectedindexchanged //event that is on the combobox
policySumInsured.ItemNo = (int)quoteTemplate.ItemNo;
policySumInsured.Description = quoteTemplate.Description;
policySumInsured.Section = quoteTemplate.Section;
if (e.ColumnIndex == 1)
//Other validation routine here
Hopefully this all makes and sense and someone could possibley shed some light on why it keeps firing the cb_selectedIndexChanged event.
Every day, thousands of innocent plants are killed by vegetarians.
So basically, you want us to write your code for you? If we provide assistance, shouldn't you be able to do that by yourself?
There are many ways, and they all depend on what you are trying to achieve. You could use FTP. You can use shared paths to copy to (a really bad idea). You can use something like TCP with a client/server infrastructure. Without knowing more about what you are trying to copy and what the constraints are, it's hard to be any more specific than that.
With some assistance I will be able to do it myself.
With this below Line of code(in vb.net) I am able to copy files from one server to another.The issue is that this copy all Files that are in the source directory folder to destination folder while i just want specific files with extension .txt
below is the code am using
My.Computer.FileSystem.CopyDirectory("\\22.214.171.124\c$\Txxx\", "\\126.96.36.199\D$\d", True)
Is there a way I can be able to just copy only text files and after copying I move the files copied to a backup folder and then delete them
You'd effectively need two operations. The first one is to use Directory.GetFiles[^] to get all the files in a particular directory (or directory structure) that have the .txt extension. Then you would need to iterate over each filename and use File.Copy[^] to copy the files over.