‎05-14-2015 06:11 AM
param (
[string]$smartname,
[Int32]$Seconds = 20,
[string]$Message = "waiting for 20 seconds to synchronise bits and pieces..please wait"
)
Import-Module ActiveDirectory
Function AddComputerToGroup{
$adgrp = Read-Host 'What is the AD group name? (Partial or full name)'
$adgrp = "*" + $adgrp + "*"
$adgrp2 = (Get-ADGroup -Filter {name -like $adgrp} | select Name,DistinguishedName,GroupCategory,GroupScope | Out-GridView -OutputMode multiple -Title 'Please select AD group name:').name
if ($adgrp2 -like $null) {
Write-Host "Please enter the AD group name:"
AddComputerToGroup
} elseif ($adgrp2 -ne $null) {
foreach ($adgrp3 in $adgrp2) {
Add-ADGroupMember -Identity "$adgrp3" -Members "$smartname$"
}
}
}
AddComputerToGroup
Write-Host "Computer is being added to groups, please wait" -foregroundcolor "red"
Function Start-Countdown{
ForEach ($Count in (1..$Seconds))
{ Write-Progress -Id 1 -Activity $Message -Status "Waiting for $Seconds seconds, $($Seconds - $Count) left" -PercentComplete (($Count / $Seconds) * 100)
Start-Sleep -Seconds 1
}
Write-Progress -Id 1 -Activity $Message -Status "Completed" -PercentComplete 100 -Completed
}
Start-Countdown -Seconds 10 -Message "Adding to Group..."
Write-Host "Computer $smartname now has the following AD Group Memberships" -foregroundcolor "green"
(Get-ADPrincipalGroupMembership (Get-ADComputer "$smartname").distinguishedname | select name).name
Write-Host "Press any key to close ..." -foregroundcolor "green"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
param (
[string]$smartname
)
Import-Module ActiveDirectory
Write-Host "Computer has the following AD Group Memberships" -foregroundcolor "green"
(Get-ADPrincipalGroupMembership (Get-ADComputer "$smartname").distinguishedname | select name).name
Write-Host "Press any key to close ..." -foregroundcolor "green"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
param (
[string]$smartname
)
C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe 1 $smartname
‎05-28-2015 05:25 PM
‎05-21-2015 10:04 PM
‎05-20-2015 02:04 AM
‎05-20-2015 12:31 AM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now