Questions tagged [adsi]

Active Directory Services Interfaces

Microsoft's implementation of LDAP, ADSI is the protocol Windows computers use to maintain a domain relationship, including groups, Organizational Units (OU's), domain controllers, etc.

268 questions
4
votes
2 answers

Constructing Active Directory entry using PowerShell works in IIS 6 but not IIS 7

The following line of PowerShell works with IIS 6 installed: $service = New-Object System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC") However, with IIS 7 it throws the following error unless the IIS 6 Management Compatibility role…
Emmett
  • 14,035
  • 12
  • 56
  • 81
4
votes
1 answer

how can I export the contents of a virtual directory change some paths and then reimport

I'm using IIS6 using powershell I would like to export a specific virtual directory to a file, change the name and some paths and then reimport the data, creating a new virtual directory It looks like IISComputer.Export would do the job but try as…
Kev Hunter
  • 2,565
  • 4
  • 25
  • 39
3
votes
2 answers

Query AD from sql server 2008 Description field gives error

I am trying to query the Active Directory with the following SQL query, which works perfectly. SELECT * FROM OpenQuery(ADSI, 'SELECT title, displayName, sAMAccountName, givenName, …
Rick
  • 2,288
  • 18
  • 66
  • 98
3
votes
2 answers

Programatically removing etag suffix (change number) from the metabase IIS6

IIS 6.0 generates eTag values in the format of "hash:changenumber". The changenumber goes up every time IIS resets, so your eTag is only valid for the lifetime of your IIS process. Restart, number goes up, hash:changenumber !=…
crb
  • 8,132
  • 6
  • 37
  • 48
3
votes
2 answers

How can I retrieve the home directory/profile path of a different local user with Windows Powershell

Rather than looking for "$env:HOMEDIR", I'm looking for a way to query the home directory of a different user account. The powershell equivalent of "~bob". I attempted using [ADSI]: # After creating a local account called 'other.user' PS> $user =…
kfsone
  • 23,617
  • 2
  • 42
  • 74
3
votes
1 answer

Convert ADSI objects to Powershell objects

I have some code to get a list of IIS6 sites through ADSI: ([adsi]"IIS://localhost/W3SVC").psbase.children | select servercomment, serverstate | Where-Object {$_.serverstate -ne $null} servercomment …
overbyte
  • 77
  • 2
  • 8
3
votes
2 answers

Powershell script returns exception when using ADSI

I get exceptions when executing a Power shell script (v1.0) on Windows Server 2008 (32 bit). It uses ADSI for searching a virtual directory before its deletion. I get the following exception: Exception calling "Find" with "2" argument(s): "Exception…
Patrick Peters
  • 9,456
  • 7
  • 57
  • 106
3
votes
1 answer

SQL ADSI Active Directory Create New Accounts

I have an ADSI connection in my SQL Server (2005) and I'm able to query it using openquery. Is there any way to create new accounts (and/or) edit existing ones? Also, I'd like to have to use openquery to get to the data, but it looks like it's the…
Rob
  • 2,080
  • 4
  • 28
  • 48
3
votes
0 answers

SQL / ADSI query with Thumbnail Limit of 4000 characters

I'm querying AD to pull user details incl. thumbnail into an SQL service using an OPENQUERY call (see below): CREATE TABLE #ADContacts(Name VARCHAR(100), Company VARCHAR(100), Title VARCHAR(100), Landline VARCHAR(100), Mobile…
3
votes
1 answer

Getting AD Group Membership ADSI using PowerShell

I currently have ADSI code to get the groups a user is a part of: $searcher = [adsisearcher]"(samaccountname=$env:USERNAME)" $searcher.FindOne().Properties.memberof $adgroups = $User -Replace '^cn=([^,]+).+$', '$1' However, i am wanting to be able…
Travis M
  • 105
  • 1
  • 2
  • 14
3
votes
1 answer

Ensure that IIS AppPool user is added to windows group

I am trying to deploy an ASP.NET application to IIS using Powershell (run by Ansible). I want my application to be able to query the performance counters so I am adding it to the Performance Monitor Users using this Powershell…
KevinG
  • 882
  • 3
  • 16
  • 33
3
votes
1 answer

Query AD from sql server 2005

I am attempting to query AD via ldap from within SQL Server 2005 but get the following error: Msg 7321, Level 16, State 2, Line 1 An error occurred while preparing the query "SELECT NAME,MAIL FROM "LDAP:///CN=foo,CN=Users,DC=bar,DC=com"" for…
Chloraphil
  • 2,719
  • 7
  • 35
  • 44
3
votes
3 answers

Trying to create a new Active Directory user, Invoke("SetPassword",pwd) throws "The RPC server is unavailable"

I'm trying to create a new user on my development active directory server using .NET System.DirectoryServices namespace. I try using the following code: DirectoryEntry dirEntry = new DirectoryEntry(path, "TESTDOM\\Administrator", "2109password",…
polo
  • 1,352
  • 2
  • 16
  • 35
3
votes
1 answer

How can I determine if an AD group contains a given DirectoryEntry from another (trusted) domain?

I am trying to beef up my code that determines whether a user is a member of a given AD group. It essentially works except when the member of the group happens to be from another (trusted) domain because it is stored as a…
JohnFx
  • 34,542
  • 18
  • 104
  • 162
3
votes
2 answers

How to remotely delete an AD-Computer from Active Directory - Powershell

I am running Powershell on a remote computer that is not connected to the domain, does not have any modules and is running PS 2.0. I want to contact the Active Directory of my domain, check if there is an entry for this computer and; if yes, delete…
Asharon
  • 353
  • 1
  • 9
  • 24
1 2
3
17 18