小编Toh*_*huw的帖子

从PowerShell对象中删除成员?

我需要从对象中删除一个成员(特别是一个NoteProperty).我该如何做到这一点?

powershell powershell-3.0

40
推荐指数
3
解决办法
4万
查看次数

Team Foundation Server 2010不尊重我的.tfignore文件

这是我的.tfignore.它位于分支的根目录中并提交给TFS,但它永远不会受到尊重.我想通过阅读TechNet关于.tfignore文件的文章,我遗漏了一些语法细微之处,但是什么?

### Team Foundation Server Source Control Ruleset Overrides for the Web Project
### These are created to ensure the proper files for the BEC Website end up
### under control.

## INCLUSIONS
# It is truly silly that VS excludes "Debug"...
!debug

# Include any binaries from sources, because they're all third party...
\sources\*.exe

## EXCLUSIONS
# Exclude site-specific tmp, cache and log folders...
wwwroot\administrator\cache
wwwroot\administrator\log
wwwroot\cache
wwwroot\log
wwwroot\tmp
Run Code Online (Sandbox Code Playgroud)

tfs tfs2010

5
推荐指数
1
解决办法
2782
查看次数

如何在PowerShell中捕获FullyQualifiedErrorId?

我有一个创建新 AD 对象的脚本(通过 New-ADObject,碰巧)。如果该对象已经存在,我需要捕获并处理它。然而,异常类型并不像FullyQualifiedErrorId 那样明确。请遵守以下规定:

> $Error[-1] | Format-List -Property * -Force

writeErrorStream      : True
PSMessageDetails      : 
Exception             : Microsoft.ActiveDirectory.Management.ADException: An attempt was made to add an object to the directory with 
                    a name that is already in use ---> System.ServiceModel.FaultException: The supplied entry already exists.
                       --- End of inner exception stack trace ---
                       at Microsoft.ActiveDirectory.Management.AdwsConnection.ThrowExceptionForExtendedError(String 
                    extendedErrorMessage, Exception innerException)
                       at Microsoft.ActiveDirectory.Management.AdwsConnection.ThrowExceptionForFaultDetail(FaultDetail 
                    faultDetail, FaultException faultException)
                       at Microsoft.ActiveDirectory.Management.AdwsConnection.ThrowException(AdwsFault adwsFault, FaultException 
                    faultException)
                       at Microsoft.ActiveDirectory.Management.AdwsConnection.Create(ADAddRequest request)
                       at Microsoft.ActiveDirectory.Management.ADWebServiceStoreAccess.Microsoft.ActiveDirectory.Management.IADSy
                    ncOperations.Add(ADSessionHandle handle, ADAddRequest request)
                       at Microsoft.ActiveDirectory.Management.ADActiveObject.Create() …
Run Code Online (Sandbox Code Playgroud)

powershell powershell-3.0

3
推荐指数
1
解决办法
3万
查看次数

Travis在Jekyll项目上失败 - 找不到Jekyll?

从下面的日志中观察Jekyll正在安装,但是错误表明无法找到它.我不清楚为什么这无法找到杰基尔 - 我是否需要陈述更明确的路径?Jekyll网站上文档没有说明为什么会出现这种情况,但我觉得这很简单,我不理解.

Using worker: worker-linux-027f0490-2.bb.travis-ci.org:travis-linux-16

Build system information
Build language: ruby
Build image provisioning date and time
Wed Feb  4 18:22:50 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:    12.04
Codename:   precise
Linux Version
2.6.32-042stab090.5
Cookbooks Version
23bb455 https://github.com/travis-ci/travis-cookbooks/tree/23bb455
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY …
Run Code Online (Sandbox Code Playgroud)

ruby bundler jekyll travis-ci

3
推荐指数
1
解决办法
954
查看次数

为什么Get-ADObject无法正确过滤ObjectClass =“ user”?

问题

Get-ADObject -Filter {ObjectClass = "User"}
Run Code Online (Sandbox Code Playgroud)

返回用户和计算机。对象类正确显示为“用户”或“计算机”。

Get-ADobject -Filter {ObjectClass = "Computer"}
Run Code Online (Sandbox Code Playgroud)

仅返回计算机。

其他观察

Get-ADObject "CN=desktop1,CN=Computers,DC=contoso,DC=com" `
| Get-Member -Property ObjectClass
Run Code Online (Sandbox Code Playgroud)

退货

TypeName: Microsoft.ActiveDirectory.Management.ADObject

Name              MemberType            Definition
----              ----------            ----------
ObjectClass       Property              System.String ObjectClass {get;set;}
Run Code Online (Sandbox Code Playgroud)

此外,这False将按预期返回:

$(Get-ADObject "CN=desktop1,CN=Computers,DC=contoso,DC=com").ObjectClass -eq "User"
Run Code Online (Sandbox Code Playgroud)

powershell active-directory powershell-3.0

1
推荐指数
1
解决办法
2万
查看次数