我有一个PowerShell脚本,通过Enter-PSSession在远程服务器上创build一个Windows PowerShell会话(PSSession),这两个服务器都没有连接到一个DOMAIN。 此脚本是从本地系统帐户下作为服务运行的程序调用的。 出于某种原因,将PowerShell脚本作为本地系统帐户运行会导致Enter-PSSession返回错误。 例如,从本地pipe理员帐户运行时,以下命令会询问我的密码并成功连接: Enter-PSSession -ComputerName #### -Credential #### 但是,如果通过psexec使用本地系统或networking服务帐户运行PowerShell,请执行以下操作: PsExec -i -s powershell.exe PsExec -i -u "NT AUTHORITY\NetworkService" powershell.exe 然后再次尝试命令它要求我的密码,只是返回一个错误消息: Enter-PSSession : Connecting to remote server #### failed with the following error message : WinRM cannot process the request. The following error with errorcode 0x8009030d occurred while using Negotiate authentication: A specified logon […]
我怎样才能通过名称而不是位置的parameter passing给COM对象? 具体来说,我有一个COM对象的function( Word文档COM对象SaveAs2 ),例如我想传递值2的第一个参数和最后一个参数(CompatibilityMode)。
基本上,我想cachingNew-PSSession所需的凭据,并将它们提供给脚本,这样他们就不用唠叨人了。 如果我使用export-clixml或类似的方式在磁盘上存储PSCredential,那么添加的风险有多大,而不是保留在会话variables中?
我正在开发一个PS脚本,它将为用户提供一个graphics用户界面(GUI)和一些button,以便执行一些基本任务,例如解锁帐户,启用/禁用,更改密码和查杀进程/closures用户。 不工作的部分是:启用/禁用用户和更改密码。 首先,一切工作作为域pipe理员,但我不能让用户一个域pipe理员,所以请不要build议:) 这是更改密码部分: $name = "osman" $Searcher = [ADSISearcher]"(sAMAccountName=$Name)" $Results = $Searcher.FindOne() $password = "pezevenk@321" [string]$adspath = $Results.Properties.adspath $enable = [ADSI]$adspath $enable.psbase.invoke("SetPassword", $password) $enable.psbase.CommitChanges() 错误是非常通用的: Exception calling "Invoke" with "2" argument(s): "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" At line:14 char:13 + $enable.psbase.invoke("SetPassword", $password) 现在,很明显,我试图给予用户适当的权限,即使我尝试了这个:我正在运行此用户具有“重置密码”和“更改密码”权限委托AD中的“用户”文件夹其中包括所有的用户。 有什么方法可以看到我错过了什么权限? 你们能想到其他的东西吗? 编辑:这些是OU的权限: "CN=Users,DC=domainname,DC=root,DC=com","All","User","ReadProperty, GenericExecute","Descendents","00000000-0000-0000-0000-000000000000","bf967aba-0de6-11d0-a285-00aa003049e2","InheritedObjectAceTypePresent","Allow","domainname\osman","False","ContainerInherit","InheritOnly" "CN=Users,DC=domainname,DC=root,DC=com","Pwd-Last-Set","User","ReadProperty, WriteProperty","Descendents","bf967a0a-0de6-11d0-a285-00aa003049e2","bf967aba-0de6-11d0-a285-00aa003049e2","ObjectAceTypePresent, InheritedObjectAceTypePresent","Allow","domainname\osman","False","ContainerInherit","InheritOnly" […]
我在SCVMM中有一个VM,VM名称不再反映OS的名称。 OS必须重命名,现在SCVMM名称中的虚拟机是不正确的,它是灰色的,所以我不能重命名它。 是否有任何Powershell cmdlet重命名SCVMM 2012 R2中的虚拟机? 谢谢
我负责创build一个脚本,用于轮询AD以获取特定信息,然后根据这些信息创build适当的电子邮件地址。 请允许我给你一点破损。 我的公司有5个电子邮件域,我们有。 所有5个都允许通过交换,但我们现在只使用一个。 目前,每个人都使用默认的company.com电子邮件地址进行设置。 我们有几个不同的品牌,我们希望将我们的用户细分,以提高电子邮件的传输能力,以便在营销决定发布大量电子邮件时帮助我们的企业电子邮件不受IP信誉的影响。 我pipe理7台Exchange 2010 DAG服务器(3个生产,3个DR,1个3天延迟)。 在PowerShell中我相当不错,并且find了我需要的代码块,所以我并不是在寻找一个完整的脚本,但是我遇到了一些麻烦。 企业想要做的是有一个脚本读取AD中的一个属性,然后基于该属性将其分配给正确的品牌。 所以,比如说。 如果AD用户具有“营销”属性,则他们将获得marketing.com电子邮件地址作为其主要答复地址,同时仍将其公司电子邮件地址保留为次要地址。 如果AD用户具有“build筑产品”作为他们的属性,building.com将是他们的回复电子邮件地址等。 我可以让PowerShell为AD查询一个属性。 我可以得到它来创build一个电子邮件。 我有麻烦找出如何让它select其他域名之一,而不是默认company.com的电子邮件地址。 任何有识之士将不胜感激。
有没有办法禁用或删除自动回复规则,可以在Outlook中创build与Powershell? 可以通过单击Outlook中“自动回复”窗口下的“规则…”button来访问它们。 我们有员工使用这些规则将电子邮件转发给他们的个人电子邮件,但是他们有时在离开组织时忘记将其closures。 我可以使用“Remove-InboxRule”cmdlet禁用收件箱规则,但是我找不到这些types的规则。 谢谢你的帮助。
从https://www.microsoft.com/en-us/download/details.aspx?id=46681下载了sccm powershell模块 通过.msi安装没有问题。 在导入时,像这样: > Import-Module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1' -Verbose > > Output (first few lines, many more snipped for brevity, then the > error): > > VERBOSE: Loading module from path 'C:\Program Files (x86)\Microsoft > Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'. > VERBOSE: Loading 'Assembly' from path 'C:\Program Files > (x86)\Microsoft Configuration > Manager\AdminConsole\bin\AdminUI.PS.TypeAdapter.dll'. VERBOSE: Loading […]
Powershell服务创build与广告凭据问题 我使用下面的powershell创build一个运行AD凭据的服务。 但是,当我运行它时,我得到一个错误的行李(也在下面)。 如果我然后编辑服务,并通过services.mmcpipe理单元input完全相同的凭据它的作品? 我怎样才能解决这个问题? 错误信息 Windows无法在本地计算机上启动“SamsService”服务。 错误1069:由于login失败,服务没有启动。 电源shell $serviceName = "SamsService" $exePath = "c:\services\service.exe" $userName = "mydomain\serviceuser" $securePassword = convertto-securestring -String "1a_really_$trong_password1" -AsPlainText -Force $credentialsObject = new-object -typename System.Management.Automation.PSCredential -argumentlist $userName, $securePassword New-Service -BinaryPathName $exePath -Name $serviceName -Credential $credentialsObject -DisplayName $serviceName -StartupType Manual
我有一个办公室365租户,我执行以下命令 Get-MsolUser -All 在服务器AI上得到 get-msoluser : The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://provisioning.microsoftonline.com/:ListUsersResult. The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph […]