AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[vbscript](server)

Martin Hope
naps1saps
Asked: 2021-09-23 09:49:27 +0800 CST

如何在 VBA 中修复“没有可用的签名证书可用”?

  • 1

我们在 Outlook 中有一个 VBA 脚本,它在发送外部电子邮件时会生成一个弹出窗口。显然脚本的签名在周末过期。签字的人已经不在了。我在我们 DC 的 CA 中看到证书,但没有续订选项。

我已经生成了一个代码签名证书并将其导入我的计算机,但 VBA 编辑器一直说No usable signing certificates are available. 我在我的证书存储中看到了证书。如果重要的话,模板会显示“代码签名”而不是原始证书“%ORG% 代码签名”。

我真的不知道自己在做什么,并且花了几个小时在网上挖掘和研究才能走到这一步。我处于死胡同,可以使用一些帮助来重新签名。如果有更好的更现代的替代方法来获取外部收件人的用户提示,请告诉我。

certificate-authority vbscript
  • 1 个回答
  • 2746 Views
Martin Hope
uday
Asked: 2021-04-06 01:06:12 +0800 CST

权限不适用于巴西机器上的文件夹,如何解决?

  • -1

我正在使用 icacls 的 RunWait 将权限应用于文件夹。

它在 Windows 10 64 位英文机器上正常工作。

但是当我在巴西机器上运行时,它不适用。

所以在巴西机器上手动运行命令并得到以下错误。

操作失败返回代码 1332。

它描述为“没有完成帐户名称和安全 ID 之间的映射”。

我知道用户在巴西机器上写成 Usuarios。

但是如何使用独立于语言的代码设置用户文件夹的权限,以便它适用于所有机器,即使语言不同。

windows vbscript icacls
  • 2 个回答
  • 75 Views
Martin Hope
Canadian Luke
Asked: 2020-12-04 15:46:25 +0800 CST

登录 VBS 脚本不会启动程序

  • 3

我正在尝试让组策略为用户 OU 运行登录脚本。该脚本运行,但它创建要运行的 Shell 对象的部分在登录期间不会加载。如果我双击脚本,它会按预期工作 - 问题出在登录期间。

以下是脚本的内容(已清理):

Dim Response,URL,WshShell,
URL = "https://forms.office.com/Pages/ResponsePage.aspx?id=REDACTED"
Response = MsgBox("Have you completed your Daily Health Check survey today?", vbYesNo + vbQuestion + 4096,"Company Name Here")s
if Response = vbNo Then
    Set WshShell = CreateObject("WScript.shell")
    WshShell.run "CMD /C start """" /MAX /B ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" " & URL, 0, False
End if
group-policy logon-scripts vbscript
  • 1 个回答
  • 484 Views
Martin Hope
Biren
Asked: 2020-11-27 19:23:02 +0800 CST

通过 Powershell 获取 Outlook 收藏项列表

  • 0

嗨,伙计们,我尝试通过 Powershell 获取 Outlook 最喜欢的项目列表,但我做不到,我已经为收件箱和其他人创建了脚本,它正在工作,但是在最喜欢的项目上遇到问题,任何人都可以帮助为最喜欢的项目做同样的事情,真的如果可以的话

$Outlook = New-Object -com Outlook.Application $Namespace = $outlook.GetNamespace("MAPI") $PublicFolder = $Namespace.Folders.Item("Favoirets - [email protected]")

在此处输入图像描述

powershell outlook vbscript
  • 2 个回答
  • 223 Views
Martin Hope
DSKyo
Asked: 2016-12-02 03:13:15 +0800 CST

VBScript MID 函数 - 无效的过程调用或参数 - 代码 800A0005

  • -1

我创建了一个 VBScript,旨在更改服务器上的文件夹共享名称。这目前作为我的测试用户的登录脚本运行。

我已经定义了这个函数:

Private Function intChangeShareName()
   Dim intPoz1, intPoz2, intIndex
   Dim strPom

   intChangeShareName = CONST_NO_CHANGE

   strActions = strActions & strOldNameShare & vbcrlf
  strPom = Trim(strOldNameShare)
  If Left(strPom, 2) <> "\\" then Exit Function

   intPoz1 = inStr(3, strPom, "\")
   intPoz2 = inStr(3, strPom, ".")
   If intPoz2 > 0 Then
      strSrvName = Mid(strPom, 3, intPoz2 - 3)
      strDomName = Mid(strPom, intPoz2 + 1, intPoz1 - intPoz2 - 1)
   Else
     strSrvName = Mid(strPom, 3, intPoz1 - 3)
      strDomName = ""
   End If

   intIndex = 0
  Do while intIndex <= UBound(arrOldSrv)
     If UCase(strSrvName) = UCase(arrOldSrv(intIndex)) Then
        If strDomName = "" Then
           strNewNameSrv = arrNewSrv(intIndex)
           strNewNameDom = ""
        intChangeShareName = CONST_CHANGE
         End If

        If UCase(strDomName) = UCase(arrOldDom(intIndex)) Then
           strNewNameSrv = arrNewSrv(intIndex)
           strNewNameDom = "." & arrNewDom(intIndex)
        intChangeShareName = CONST_CHANGE
         End If
      End If
      intIndex = intIndex + 1
   Loop

   If intChangeShareName = CONST_CHANGE Then
      strNewNameShare = "\\" & strNewNameSrv & strNewNameDom & Mid(strPom, intPoz1)
      strActions = strActions & "*  " & strNewNameShare & vbcrlf
      blRequireLogoff = True
'       Wscript.Echo "a " & strNewNameShare
   End If

End Function

但是,每次我登录时都会收到以下错误:VBScript 运行时错误 - 无效的过程调用或参数:'Mid' - 代码 800A0005

我看不出我的 Mid 功能有什么问题,有人可以帮我吗?

group-policy logon-scripts vbscript
  • 1 个回答
  • 2498 Views
Martin Hope
DSKyo
Asked: 2016-09-06 06:34:39 +0800 CST

如何使用 powershell v2.0 或 CMD / VBS 检查是否在 AD 中禁用了特定的用户帐户列表

  • 2

1) 我有一个带有 sAMAaccountNames 的 txt 列表

2)我需要查询每个账户名并验证是否被禁用

3)如果帐户被禁用,从AD中删除它

如果没有其他方法,我将手动删除它们,但首先我需要检查列表中的所有帐户以查看它们是否被禁用。

我在这台服务器上安装了 powershell v2.0,DC 是 windows server 2003。管理服务器是 windows server 2008。

我没有 Active Directory 模块,也无法安装它。

如何使用 CMD/VBScript 或 powershell v2.0 执行此操作?

我试过跑

dsquery -Filter "(userAccountControl:1.2.840.113556.1.4.803:=2)"

但我收到以下错误dsquery failed:The parameter is incorrect.:Incorrect object type specified. type dsquery /? for help.

scripting powershell windows-command-prompt vbscript
  • 2 个回答
  • 27147 Views
Martin Hope
Vysakh
Asked: 2016-04-14 07:26:43 +0800 CST

如何获取特定用户帐户的所有登录时间

  • 0

我知道使用事件查看器来检查谁登录系统以及何时登录。但我试图找出一个特定的本地用户帐户,比如管理员 - 该机器上这个特定用户的登录日期和时间是什么。我使用这个脚本,它说我的登录总数,但不是全部。脚本如下。

'Get our list of logons
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkLoginProfile",,48)

'Converts to a readable logon date and time function ConvertTime(sTime)
if (sTime="**************.******+***") then
ConvertTime = "Unknown"
else
if (Trim(sTime)="") then
sTime="Unknown"
else
 sYear = Mid(sTime,1,4)
 sMonth = Mid(sTime,5,2)
 sDay = Mid(sTime,7,2)
 sHour = Mid(sTime,9,2)
 sMin = Mid(sTime,11,2)
 sSec = Mid(sTime,13,2)
end if 
ConvertTime = sMonth & "/" & sDay & "/" & sYear & " (" & sHour & ":" & sMin & ":" & sSec & ")"
end if
end function

'Loops through our logon items and only pulls out the 
'user accounts...not system accounts that are used
'internally by windows

For Each objItem in colItems
 if (objItem.UserType = "Normal Account") then
 Wscript.Echo objItem.Name & vbCrLf
 Wscript.Echo " Last Logon: " & ConvertTime(objItem.LastLogon)
 Wscript.Echo " Number of Logons: " & objItem.NumberOfLogons 
  if (objItem.Privileges=0) then
   WScript.Echo " (Guest Account)"
  else if (objItem.Privileges=1) then
   WScript.Echo " (Standard User Account)"
   else if (objItem.Privileges=2) then
    WScript.Echo " (Administrator Account)"
   end if
 end if
end if
WScript.Echo vbCrLf
end if  
Next

编辑以显示预期输出

Username: LocalPC\Administrator
Logon time: ------
Username: LocalPC\Administrator
Logon time: ------

有人可以告诉我如何修改这个脚本,或者有没有其他方法可以尽快以最简单的方式检查它。?提前致谢。

login windows-server-2012-r2 vbscript
  • 3 个回答
  • 1430 Views
Martin Hope
mindmischief
Asked: 2015-09-03 14:07:07 +0800 CST

为 vbs 'All Users' 脚本设置登录脚本标志,使其不再运行

  • 0

我们有一个 vbs All Users 脚本,它在用户登录时创建一堆打印机(大约 25 台打印机)。运行需要一两分钟,所以如果没有必要,我们不希望它再次运行。如何设置某种标志,以便该脚本在已经为用户运行时不会运行?在运行后删除脚本将不起作用,因为它需要为可能尚未登录的后续用户运行。

vbscript
  • 1 个回答
  • 307 Views
Martin Hope
user318320
Asked: 2014-09-30 11:59:54 +0800 CST

为特定用户设置默认打印机的脚本

  • 0

我们为我们的实验室安装了多台打印机。我们在 AD 中有一个特殊的测试帐户,它无法打印到正在进行测试的房间以保护个人信息。

我需要一个登录脚本,它将根据此用户是否登录将不同的打印机设置为默认打印机。

这就是我们现在必须通过 OU 设置默认打印机的内容。我想在最后为用户添加一行。

Set objSysInfo = CreateObject("ADSystemInfo")
strName = objSysInfo.ComputerName

arrComputerName = Split(strName, ",")
arrOU = Split(arrComputerName(1), "=")
strComputerOU = arrOU(1) 

Set objNetwork = CreateObject("WScript.Network")

Select Case strComputerOU
Case "OU for Printer 1"

    objNetwork.SetDefaultPrinter "Printer 1"

Case "OU for Printer 2"

    objNetwork.SetDefaultPrinter "Printer 2"

Case "OU for Printer 3"

    objNetwork.SetDefaultPrinter "Printer 3"

Case "LabColorPrinter"

    objNetwork.SetDefaultPrinter "Color Printer"

Case Else
    objNetwork.SetDefaultPrinter "Printer 1"

End Select
vbscript
  • 1 个回答
  • 1489 Views
Martin Hope
Mr. Lost IT Guy
Asked: 2013-01-12 06:48:38 +0800 CST

通过 VBScript 导出 SCCM 2007 查询结果

  • 0

我想知道是否可以通过 VBScript 导出 SCCM 2007 查询的结果。如果有任何建议,将不胜感激。

我知道我可以通过 VBScript 通过 SCCM 导出报告,方法是使用报告的 Web 视图并伪造 export=yes 并提交表单。查询可能会发生这样的事情吗?

我最终得到的作为 VBScript 函数的工作代码:

'sccmQueryAsArray
'Returns: results in an array built based on the columns specified in the call of the function
'   parseInto: an array provided by the calling function that will be filled with the SCCM query results
'   sccmSiteServerName: a string representing the sccm site server we are connecting to
'   sccmSiteCode: a string representing the sccm site code we are connecting to
'   columns: a one dimensional array containing the names of the columns you want to the function to create an array for
'   query: the actual full length query that will be passed to WMI object
'       example call: sccmQueryAsArray data,"server1","sit",array("Name","UsergroupName"),"select Name, UsergroupName, WindowsNTDomain from sms_r_usergroup where AgentName = 'SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT'"
'       results in an array "data" being modified to 2 columns and as many rows as is returned by the query the array would look like:
'           (0)(x) where 0 = the first element in the columns row or Name
'           (1)(x) where 1 = the second element in the columns row or UsergroupName
function sccmQueryAsArray( ByRef parseInto, ByVal sccmSiteServerName, ByVal sccmSiteCode, ByVal columns, ByVal query )

redim preserve parseInto(ubound(columns),0) 'the array that the query information will be parsed into and then returned

dim objWMIService: set objWMIService = getObject("winmgmts://" & sccmSiteServerName & "\root\sms\site_" & sccmSiteCode) 'set up the connection string
dim colGroups: set colGroups = objWMIService.ExecQuery(query) 'execute the query and put the results into colGroups

dim z: z = 0
dim objGroup: for each objGroup in colGroups
    dim y: for y = 0 to ubound(columns) step 1
        dim x: x = "objGroup." & columns(y)
        parseInto(y,z) = eval(x)
    next
redim preserve parseInto(ubound(parseInto,1),ubound(parseInto,2)+1): z = z + 1
next

sccmQueryAsArray = parseInto

end function
vbscript
  • 2 个回答
  • 2111 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve