| Topic |
 |
RE: Efficiency ? IMO it is better to create the object once with New-Object and then just rebuild the properties for each user. Something like the code below. You do need to be careful to clear out any old data if it is possible not every user will have all the prop ... by Brandon Shell [MVP] in General PowerShell on 24 Aug 2009 04:31 AM
|
 |
RE: Powershell script that will log off ICA and RDP sessions. Why would you want to randomly log people off? I assume you don't which means we are missing a critical piece of the puzzle. Can you elaborate on exactly what your goal is? by Brandon Shell [MVP] in General PowerShell on 19 May 2009 07:56 AM
|
 |
RE: Listing Users in Nested Groups If your in a single Domain... you can try my Get-TokenGroups script blogged here http://bsonposh.com/archives/541 by Brandon Shell [MVP] in Active Directory on 12 Jan 2009 01:52 PM
|
 |
RE: AD lastlogon value conversion The problem is that it is not a normal Large Int. It is specifically a iADSLargeInteger. If it was a regular [int64] then Powershell would do the conversion for you. I have a blog entry that explains this and possible workarounds. http://bs ... by Brandon Shell [MVP] in Active Directory on 08 Jan 2009 05:26 AM
|
 |
RE: Modular Scripting Question p.s. You can add a script and its variables into your current scope by . sourcing the script. . [script removed] by Brandon Shell [MVP] in General PowerShell on 29 Dec 2008 01:08 PM
|
 |
RE: Modular Scripting Question You do not need functions.. you can make each "module" a script. Just cut/paste code into a file and save as .ps1 Note: You may want to configure Parameters for some scripts using the Param statement by Brandon Shell [MVP] in General PowerShell on 29 Dec 2008 01:07 PM
|
 |
RE: What is the best way to loop a script forever? while($true) { do something } by Brandon Shell [MVP] in General PowerShell on 29 Dec 2008 12:59 PM
|
 |
RE: Checking if domain users belong to a particular group I have a little script (that I plan to blog about shortly) that uses tokengroups constructed attributes to return a complete list of groups a user is a member of (including nested groups.) using this script you can do something like if(Get-TokenGr ... by Brandon Shell [MVP] in Active Directory on 24 Dec 2008 08:33 AM
|
 |
RE: User Must Change Password At Next Logon My example was not using the Quest cmdlets. I was just illustrating that it is a property to set. Shay's example is valid by Brandon Shell [MVP] in Active Directory on 05 Nov 2008 05:31 AM
|
 |
RE: Changing AD Account Values $users = (gc c:\test-deps.txt) foreach ($user in $users) { Set-QADUser "$user" -oa @{'title'='Departmental'} -ea 0 if(!$?) { "User [{0}] failed" -f $user } } by Brandon Shell [MVP] in Active Directory on 03 Nov 2008 10:00 AM
|
 |
RE: get-process on remote machine and only a specifice process Unless you are using the v2 CTP this will not work. You need to use .NET class directly [system.Diagnostics.Process]::GetProcessesByName($processName,$Computer) by Brandon Shell [MVP] in General PowerShell on 03 Nov 2008 09:55 AM
|
 |
RE: Exporting inactive users to csv WITH lastLogonTimeStamp That would be your problem. This is a 2k3 native mode thing by Brandon Shell [MVP] in Active Directory on 24 Oct 2008 09:39 AM
|
 |
RE: Exporting inactive users to csv WITH lastLogonTimeStamp You do not... I do it because I have ~380k users, not what I want to test against :) by Brandon Shell [MVP] in Active Directory on 24 Oct 2008 07:57 AM
|
 |
RE: Seperating a returned object into several objects I would change where {$_ -notmatch "x" -and $_ -like "smtp:*"} to, or what ever regex fits... no reason to compare twice where {$_ -match "smtp\:.*"} by Brandon Shell [MVP] in General PowerShell on 24 Oct 2008 07:06 AM
|
 |
RE: Exporting inactive users to csv WITH lastLogonTimeStamp slogick, you can not use both what I gave you and what Shay gave you. I recommend downloading the latest Quest cmdlets and use what Shay provided... it is much cleaner than mine. by Brandon Shell [MVP] in Active Directory on 24 Oct 2008 07:03 AM
|
 |
RE: User Must Change Password At Next Logon You need to set pwdLastSet to -1 Like $user.put("pwdLastset",-1) $user.setinfo() by Brandon Shell [MVP] in Active Directory on 24 Oct 2008 07:01 AM
|
 |
RE: Exporting inactive users to csv WITH lastLogonTimeStamp Perhaps it is my version of Quest tools, but I do not have AccountIsDisabled or lastLogonTimestamp (I tried that both first expecting them to be there) by Brandon Shell [MVP] in Active Directory on 24 Oct 2008 06:45 AM
|
 |
RE: Exporting inactive users to csv WITH lastLogonTimeStamp perhaps something like (with Quest tools) $users = Get-QADUser -SearchRoot $OU -IncludedProperties "lastLogonTimestamp" @(foreach($user in $users) { $user | Select-Object DisplayName, LogonName, ... by Brandon Shell [MVP] in Active Directory on 24 Oct 2008 06:24 AM
|
 |
RE: Error handling of undefined AD attributes, and unable to set extensionAttributex $attr5 = $objUser.psbase.properties["extensionAttribute5"] by Brandon Shell [MVP] in Active Directory on 24 Oct 2008 05:52 AM
|
 |
RE: Exporting inactive users to csv WITH lastLogonTimeStamp and what do you consider expired? by Brandon Shell [MVP] in Active Directory on 23 Oct 2008 09:28 AM
|
 |
RE: Exporting inactive users to csv WITH lastLogonTimeStamp I am a little unclear as to exactly what you want. You want all the expired user accounts export to csv with only the properties you specified? by Brandon Shell [MVP] in Active Directory on 23 Oct 2008 09:28 AM
|
 |
RE: query machine name, operatingSystem doesn't work btw.... here is another way to accomplish your goal (using the DirectorySearcher constructor to pass the info) $strFilter = "objectCategory=Computer" $colProplist = "name", "operatingSystem" $objDomain = New-Object System.DirectoryServices.Dire ... by Brandon Shell [MVP] in Active Directory on 23 Oct 2008 09:19 AM
|
 |
RE: Error handling of undefined AD attributes, and unable to set extensionAttributex A better option would be using the LDAP filter to only return users with extensionAttribute5 not set "!(extensionAttribute5=*)" by Brandon Shell [MVP] in Active Directory on 23 Oct 2008 09:14 AM
|
 |
RE: An observation concerning case That is a qwerk with DirectorySearcher and I have let the approperiate people know. by Brandon Shell [MVP] in General PowerShell on 23 Oct 2008 09:10 AM
|
 |
RE: Sync two folders and shutdown the machine Sorry bout that. I did an upgrade on my site that required that change :( by Brandon Shell [MVP] in General PowerShell on 21 Oct 2008 11:33 AM
|
 |
RE: Seperating a returned object into several objects That was supposed to be -expand, but the -expan will work as well :) by Brandon Shell [MVP] in General PowerShell on 21 Oct 2008 08:01 AM
|
 |
RE: Seperating a returned object into several objects Try this get-qaduser "joe bloggs" -includeallproperties | select -expan proxyaddresses by Brandon Shell [MVP] in General PowerShell on 21 Oct 2008 08:01 AM
|
 |
RE: GWMI -filter parameter questions. Not a typo for me... I used $creds :P by Brandon Shell [MVP] in General PowerShell on 21 Oct 2008 07:57 AM
|
 |
RE: Wildcards don't work -contains is a containment operator meaning it is used to test for values in an Array. What you want is -like (wildcard operator) Commands for more info help about_Operator help about_Comparison_Operators by Brandon Shell [MVP] in General PowerShell on 21 Oct 2008 07:54 AM
|
 |
RE: GWMI -filter parameter questions. Not sure why you are doing all that voodoo with the username. I don't think you have to escape the backslash, but I haven't tried either. You can try this. $filter = "startname='{0}\\{1}'" -f $creds.UserName.split("\") by Brandon Shell [MVP] in General PowerShell on 20 Oct 2008 03:24 PM
|