如何创建一种将结果输入到文本文件的方法?

时间:2019-01-03 16:44:08

标签: vbscript

是否有任何方法可以将代码结果放入本地文本文件中。

我尝试了很多代码,但是没有任何作用。

On Error Resume Next

Dim wshNetwork
Dim strComputerName
Dim strPassword
Dim colAccounts

Set wshNetwork = WScript.CreateObject( "WScript.Network" )
strComputerName = wshNetwork.ComputerName

strPassword = ""

Set LocalAccounts = GetObject("WinNT://" & strComputerName)
LocalAccounts.Filter = Array("user")

Dim Flag

Flag = 0 
For Each objUser In LocalAccounts
    objUser.ChangePassword strPassword, strPassword
    If Err = 0 Or Err = -2147023569 Then
        Flag = 1
        WScript.Echo "The account """ & objUser.Name & """ is not password protected."
    End If
    Err.Clear
Next

If Flag = 0 Then
    WScript.Echo "All User Accounts are password protected." 
End If

0 个答案:

没有答案