Go Back   Hardware Canucks > SOFTWARE > O/S's, Drivers & General Software

    
Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old August 13, 2013, 08:11 PM
Top Prospect
 
Join Date: Apr 2013
Location: Ottawa
Posts: 220

My System Specs

Default

Quote:
Originally Posted by JD View Post
As "pseudo-code", I think it would be:

$num = 1
Do until num=7
$tsname = "ts" + num
&$delprof /u /c:$tsname /id:$user
$num = $num + 1
End
YES, I was looking at that last night, but couldn't get the syntax right, remember I said scripting isn't my thing....yet....but I wasn't sure if that's what I needed or not since I couldn't get it working. that looks like it could do it.


uhm.....no....not working

Last edited by stlouis1; August 13, 2013 at 08:24 PM.
Reply With Quote
  #22 (permalink)  
Old August 13, 2013, 09:46 PM
grinder's Avatar
Allstar
F@H
 
Join Date: Mar 2007
Posts: 822

My System Specs

Default

strings do not concatenate well with numbers

try this approach?

Code:
$num = 1
Do until num=7
$args = " /u /c:ts" + $num.tostring() + " /id: " + $user
&$delprof $args
$num = $num + 1

End
__________________
Phenom II 945 :: ASUS M4A78-E (780G) :: BFG 285GTX :: 4GB Mushkin DDR2 (5-4-4-12) :: Creative Xi-Fi :: Seagate 500 gig 7200.12 (better than WD BLACK!!!!!) :: Samsung 2493HM
Reply With Quote
  #23 (permalink)  
Old August 13, 2013, 09:52 PM
Top Prospect
 
Join Date: Apr 2013
Location: Ottawa
Posts: 220

My System Specs

Default

ah, did the forum go down for a bit? i've been refreshing it for an hour lol. but in that time, I did get it working, and this is what I have. JD was pretty close though

Code:
# Running delprof on terminal servers
$num = 1

do {
$tsname = "ts" + $num
&$delprof /u /c:$tsname /id:$user
$num = $num + 1
}

# modify this value to adjust the number of terminal servers
until ($num -gt 7)
just for fun though, I've been poking around, and the Get-ADUser function outputs the specified account SID, which means realistically, I could bypass delprof2 entirely by parsing the Get-ADUser output to grab the SID and then use the Remove-Item function to remotely remove the registry key from the profilelist key in the remove registries of the terminal servers and also remove the profile folders remotely as well.

But the problem with that approach, is that on top of having remote management enabled which because we're in a remote monitoring and management environment, that's a given, we'd also have to relax the powershell scripting policies on multiple servers, and until our monitoring application moves to a remote powershell rather than remote command prompt, essentially telnet, I don't see that happening since the idea is to keep the least number of entry points possible, closing one to open another is one thing, but opening more on top of the existing is another

Last edited by stlouis1; August 14, 2013 at 05:15 AM.
Reply With Quote
  #24 (permalink)  
Old August 14, 2013, 06:22 AM
JD's Avatar
JD JD is offline
Moderator
F@H
 
Join Date: Jul 2007
Location: Toronto, ON
Posts: 6,945

My System Specs

Default

Haha, that code I posted was by no means PowerShell, I was merely guessing at commands and I definitely don't know PS that well.

Glad you found the proper syntaxes though!
Reply With Quote
  #25 (permalink)  
Old August 14, 2013, 06:54 AM
Top Prospect
 
Join Date: Apr 2013
Location: Ottawa
Posts: 220

My System Specs

Default

oh ya, I sorted it. I was surprised to see that what I was looking at yesterday was in the right direction.

I also found a code snipet online to generate passwords, I did some tweaking to it though to make some formatting adjustments.

but basically, I have my account removal script done, it disables the account, resets the password to a semi-random generated password. moves the roaming profile to the temporary backup location and appends the date when it can be deleted. And it runs delprof2 against the terminal servers to clean the locally stored profile data

The only thing it doesn't do is forward exchange mail, but that would require having the exchange modules available.

Though it would be nice to have it create a scheduled task to delete the folder on the date to be deleted


I also made another one to create the accounts, unfortunately it doesn't save me as much time, but it automates the steps involved and cuts down the amount of room for error. So unless you can't spell the persons name or figure out how to copy and paste it, then your have to be an idiot to mess it up
Reply With Quote
Reply


Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
which types of files are good on a SSD drive Shadowmeph Storage 5 October 13, 2012 07:45 PM
.rar files SGardiner O/S's, Drivers & General Software 17 July 7, 2011 05:05 AM
X-Files Blu Off Topic 15 May 26, 2011 06:57 PM
Batch files. encorp O/S's, Drivers & General Software 33 October 8, 2010 12:47 PM
Restoring files? Phobia O/S's, Drivers & General Software 6 January 19, 2009 01:14 PM