WordPress.com
#################################################
## Created By: Luke Salter ##
## Created On: 26/05/2014 ##
## SCCM Collection Creation Based on CSV Input ##
#################################################
## Import ActiveDirectory cmdlets
import-module "C:\Windows\System32\WindowsPowerShell\v1.0\Modules\ActiveDirectory\ActiveDirectory.psd1"
## Create GG ActiveDirectory Groups
Function CreateGGADGroup {
IF (!(Get-WMIObject -namespace "root\directory\ldap" -query "select * from ds_group where ds_name = 'SCCM_GG_$APPName'")){
New-ADGroup -Name SCCM_GG_$APPName -Path “OU=Global Groups,OU=Live,OU=SCCM2012,OU=Applications,OU=Security Groups,DC=english-heritage,DC=org,DC=uk” -Description “SCCM2012 Groups” -GroupCategory Security -GroupScope Global
}
ELSE
{ECHO "SCCM_GG_$APPName ADGroup Already Exists"}
}
## Create DL ActiveDirectory Groups
Function CreateDLADGroup {
IF (!(Get-WMIObject -namespace "root\directory\ldap" -query "select * from ds_group where ds_name = 'SCCM_DL_$APPName'")){
New-ADGroup -Name SCCM_DL_$APPName -Path “OU=Domain Local,OU=Live,OU=SCCM2012,OU=Applications,OU=Security Groups,DC=english-heritage,DC=org,DC=uk” -Description “SCCM2012 Groups” -GroupCategory Security -GroupScope DomainLocal
}
ELSE
{ECHO "SCCM_DL_$APPName ADGroup Already Exists"}
}
## Add members to the AD Groups
Function AddUserToAD {
$GroupMembers=(Get-ADGroupMember -identity SCCM_GG_$APPNAME | select-object -expandproperty sAMAccountName)
$DLGroupMembers=(Get-ADGroupMember -identity SCCM_DL_$APPNAME | select-object -expandproperty sAMAccountName)
if ($DLGroupMembers -notcontains 'SCCM_GG_'+$APPNAME){
ADD-ADGroupMember -identity SCCM_DL_$APPNAME -Members SCCM_GG_$APPNAME
}
ELSE
{ECHO 'SCCM_GG_'$APPNAME" already in group"}
}
## Place-holder function
Function DoNothing {}
## Import AppNames
import-csv "C:\Temp\Powershell\ADAcounts\Applications1.CSV" | foreach {
$Application=$_.APPNAME
##Create Install/Uninstall Variable
$InstallType = ('_Install','_Uninstall')
foreach ($InstType in $InstallType) {
## Collection Name Variable for each row in the CSV File
$APPNAME=$Application+$InstType
## Run Create Group Function
CreateGGADGroup
CreateDLADGroup
AddUserToAD
}
}
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
Related searches
- wordpress passing data between pages
- wordpress business templates
- wordpress rss feed not working
- wordpress jquery is not defined
- create wordpress blog
- wordpress roles editor
- wordpress full rss feed
- wordpress rss feed settings
- wordpress rss feed plugin
- wordpress display rss feed
- wordpress rss feed link
- wordpress rss feed to post