View Single Post
Old 11-26-2007   #5 (permalink)
Shay Levi


 
 

Re: schedule a task with WMI?

For your second request see Brandon's function ("Re: Windows XP, Users and
Groups" thread)

function Add-UsertoLocalGroup{
Param([string]$user,[string]$group,[string]$server)
If(!($server)){$server = get-content env:COMPUTERNAME}
Write-Host "Adding User [$user] to group [$group]"
Write-Host "----------------------------------------------" -ForegroundColor
gray
$srv = [ADSI]("WinNT://$server,computer")
$u = [ADSI]("WinNT://$server/$User,User")
# Getting Group and Adding User
$g = [ADSI]("WinNT://$server/$group,group")
$g.psbase.invoke("add",$u.psbase.path)
}


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com


Quote:

> i just wrote a script to do backups (with an imaging product) and now
> i want to make a script to deploy this and there are two things i need
> to do that im not really sure how to do.
>
> 1) create a schedule task with WMI (i want wmi so i can do it
> remotely)
> 2) create an account and add it to the admin group
> 3) modify the remote systems path enviornment var. (not a must, but
> would be
> nice)

My System SpecsSystem Spec