重置WSUS数据库(SQL Server版)

停止WSUS服务
用管理员方式打开SQLServer Management Studio
打开数据库\\.\pipe\MICROSOFT##WID\tsql\query
使用Windows账号方式登录数据库
则可以看到WID的数据库SUSDB

在SQLServer Management Studio中删除SUSDB
SQL –> expand databases-> 右击SUSDB –> Delete
记得选中“Close existing connections”

查看注册表HKLM\Software\Microsoft\Update Services\Server\Setup\ContentDir *
找到WSUS的下载目录,清空该目录。

启动WSUS服务

运行以下命令进入安装(重装)WSUS后的状态,在服务器中打开WSUS重新运行安装向导,WID数据库会重建。
C:\Program Files\Update Services\Tools\Wsusutil.exe postinstall SQL_INSTANCE_NAME=”Server\Instance”
以下参数可不加:
CONTENT_DIR=”注册表中的ContentDir ”

附录:

1、运行以下命令,则保留WID数据库,重置已下载的更新包(很耗时)。
C:\Program Files\Update Services\Tools\WsusUtil.exe reset

2、当WSUS因为前一配置变动而假死(不再接受新的配置)时,可以在SQLServer Management Studio运行以下命令,解除锁死。
UPDATE tbSingletonData
SET ResetStateMachineNeeded = 0

Advertisements

Windows 7+ 对C盘根目录写文件

发现Windows 7开始,UAC加强了,在C盘根目录无法写文件,必须要提升权限至超级管理员。英文网页找了半天各种方法都不好使,于是有了下面的中文方法。果然可行。

下文摘自:http://www.anquanjiaofu.com/40000/39334.shtml

1、 按“Win X”快捷键,在弹出菜单中选择“命令提示符(管理员)”,输入“icacls c:\ /setintegritylevel M”命令回车,稍等几分钟,执行完成即可将C盘安全级别下调至M级。(如果想要恢复的话,则使用icacls c:\ /setintegritylevel H即可将C盘安全级别上升至H级。)

2、 右击C盘“属性”,在弹出“本地磁盘C属性”对话框,点击“安全”选项,组或用户名下选择“authenticated users”→“编辑”,在authenticated users的权限,将完全控制(或修改)对应的允许勾选,然后点击“确定”。

按照上述的方法设置后,再次向C盘复制或移动文件时,就不会提示目标文件夹访问被拒绝的提示了。或许有些用户喜欢直接将system权限更改为everyone,但这样设置会造成“开始”里的应用程序出现闪退,应用程序无法使用的现象,所以我觉得还是不要修改system权限。

MSI自动修复功能

MSI安装包的自动修复功能有点蛇足。安装后如果用户改动了某个安装包关键组件里定义的目录或文件或者访问权限等,运行程序时会自动弹出安装包让用户重新安装。调查了一下,关键还是在注册表。微软官方文档提示:禁用自动修复功能应在注册表位置HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer创建一个DWORD型变量DisableMSI,并设置值为2(或1仅作用于nonmanaged applications,http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q303439)。不过重新安装的窗口还是会一闪而过,不爽。

那么看一下Windows的Event Log。会看到一些警告如:
Detection of product ‘{ProductGUID}’, feature ‘FeatureName’, component ‘{ComponentGUID}’ failed. … (details)

接下来在注册表的HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components
下找到相应的组件。组件的注册表值可以通过GUID计算获得。规则是,GUID的前三组(-分割)整组数字倒置,后二组每位数字两两倒置,再去除-分隔符后连接。例如:
GUID={3D9E559E-8A5D-56A4-924C-4B0863336B38}
RegKey=E955E9D3D5A84A6529C4B4803633B683

找到注册表位置后,将值设为空即可。

Windows 8不能在VirtualBox安装64位虚拟机的问题

升级到Windows 8,发现以前在VirtualBox使用的64位虚拟机不工作了(包括所有类型的操作系统)。

问题描述:旧版或新版VirtualBox启动虚拟机时直接失败。旧版添加新的虚拟机时不需指定32位或64位,但是添加后无法启动虚拟机。当前最新版VirtualBox(4.3.10)添加新的虚拟机时,所有的64位操作系统都没有在可选项中列出,即无法创建64位虚拟机。

网上搜索了半天,找到两个原因。

1、BIOS必须开启Virtualization Technology (VTx)选项

2、禁用Windows 8默认开启的Windows Feature:Hyper-V(微软闲的?)

 

2016年8月1日补充:
在一台新的Windows 8 (64 bit)机器上,安装了VirtualBox 5.1,然后试图安装Ubuntu 16.04 LTS (32bit),无论是运行Live CD还是直接安装,都黑屏或者卡住。网上找了些解答都不对症,如在Live CD安装前调整什么启动选项(F6),或者是Nvidia显卡驱动问题等。最终原因还是由于Hyper-V。禁用Hyper-V后重启,问题解决。

IE10降级到IE9无法下载的问题

什么,IE无法下载文件(其他浏览器下载没问题),API调用URLDownloadToFile总是失败?

IE临时目录还在吗?目录大小是0吗?有读写权限吗?IE设置重置了吗?禁用所有加载项了吗?组策略允许IE下载吗?关闭保护模式试了吗?关闭防毒防火软件试了吗?都试了还不行,看下文。

 

Traceback: http://social.technet.microsoft.com/Forums/ie/en-US/9f0273da-6320-47b2-b4a3-00c5c30e7324/unable-to-download-after-downgrading-from-ie10?forum=ieitprocurrentver

After downgrading from IE10 to IE9:

Symptoms

Going into Internet Options>General tab>Browsing history-Settings shows the following:

1) Disk space to use = 0
2) Current location = <blank>
Attempting to increase the size of the Disk space to use results in the error popup:
Please select a value between 8 and 8 for how much disk space Temporary Internet Files may use.”
 Attempting to Move folder is also unsuccessful.

Solution

1) Login as the affected user.
2) Run regedit (supply admin credentials as needed.)
3) Navigate to:

  HKCU\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\Cache
4) Delete (or rename, if you want to be cautious) the following key (and its subkeys):
Extensible Cache
5) You may now open IE (no need to relog,reboot or exit regedit).
6) IE will automatically create new Extensible Cache registry keys
7) Navigate to
Internet Options>General>Browsing history-Settings
8) You should now have “Disk space to use” = 250, and the “Current location” should show a valid path.
9) Once you are satisfied of success, delete the old renamed keys.

10) Repeat for each affected user of that PC.

Fix 550 5.7.1 Unable to relay

一个奇怪的问题,公司局域网内使用System.Web.Mail发信可以,但是不能发网外。异常为“The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay”。环境为Windows7+IIS7+VS2010。

了解到Windows Vista开始IIS7不再附带SMTP Service,如果是Windows XP+IIS6,修正方法如下:

System.Web.Mail is working correctly, and is attempting to send the email. However, your SmtpMail.SmtpServer is not allowing relaying. Try one of the following suggestions:

  • Make sure the MailMessage.From is a valid email address that exists on the SmtpMail.SmtpServer.
  • Allow relaying for your MailMessage.From address (see your specific mail server documentation for this)
  • Allow relaying for your IP Address (see your specific mail server documentation for this).
  • Try authenticated first, before sending the email. Check out 3.8 How do I authenticate to send an email?
  • If you are using the IIS SMTP Service try allowing relaying for your IP address by:
    • Opening the IIS Admin MMC
    • Right-Clicking on the SMTP Virtual Server and selecting Properties
    • On the Access tab, click the Relay button
    • Grant 127.0.0.1 (or the IP address used by System.Web.Mail) to the Computers list.
    • Close all dialogs
    • Restarting the SMTP Service

How do I authenticate to send an email?

If you are using the .NET Framework 1.0, this cannot be done. However, in the 1.1 version, the MailMessage.Fields property was added. This allowed access to the underlying CDO.Message fields.

The following example demonstrates sending your username and password to the SMTP server to provide authentication.

[ C# ]

private void Page_Load(object sender, System.EventArgs e)
{
	MailMessage mail = new MailMessage();
	mail.To = "me@mycompany.com";
	mail.From = "you@yourcompany.com";
	mail.Subject = "this is a test email.";
	mail.Body = "Some text goes here";
	mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");	//basic authentication
	mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
	mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret");	//set your password here

	SmtpMail.SmtpServer = "mail.mycompany.com";  //your real server goes here
	SmtpMail.Send( mail );
}

[ VB.NET ]

Private Sub Page_Load(sender As Object, e As System.EventArgs)
   Dim mail As New MailMessage()
   mail.To = "me@mycompany.com"
   mail.From = "you@yourcompany.com"
   mail.Subject = "this is a test email."
   mail.Body = "Some text goes here"
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here") 'set your username here
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret") 'set your password here
   SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
   SmtpMail.Send(mail)
End Sub 'Page_Load

Windows7+IIS7的修正方法如下:

安装另一个SMTP服务器如,FreeSMTP。然后将SmtpMail.SmtpServer设为"localhost"。

参考文章:http://www.systemwebmail.com/faq/4.3.11.aspx

WinDbg符号路径设置

c:windowssymbols;.sympath SRV*d:localsymbols*http://msdl.microsoft.com/download/symbols