Jump to content


Sysadmin1973

Established Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Sysadmin1973

  1. Yes Sorry, see below snapshot Import-Module : The 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1 module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest me bers are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Descript on', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'Proc ssorArchitecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'Requir dAssemblies', 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport' . Remove the members that are not valid ('HelpInfoURI'), then try to import the module again. At line:2 char:18 + Import-Module <<<< ($installdrive + "\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\Conf gurationManager.psd1") + CategoryInfo : InvalidData: (C:\Program File...ionManager.psd1:String) [import-Module], InvalidOperatio nException + FullyQualifiedErrorId : Modules_InvalidManifestMember,Microsoft.PowerShell.Commands.ImportModuleCommand Set-Location : Cannot find drive. A drive with the name 'S01' does not exist. At line:13 char:13 + Set-Location <<<< $sitecode + CategoryInfo : ObjectNotFound: (S01:String) [set-Location], DriveNotFoundException + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand The term 'Set-CMQueryResultMaximum' is not recognized as the name of a cmdlet, function, script file, or operable prog am. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:14 char:25 + Set-CMQueryResultMaximum <<<< -Maximum $maxdevices + CategoryInfo : ObjectNotFound: (Set-CMQueryResultMaximum:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException The term 'Get-CMDevice' is not recognized as the name of a cmdlet, function, script file, or operable program. Check t e spelling of the name, or if a path was included, verify that the path is correct and try again. At line:15 char:26 + $Computers = Get-CMDevice <<<< -CollectionName "All Systems" | ForEach-Object {$_.Name} + CategoryInfo : ObjectNotFound: (Get-CMDevice:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
  2. # # Script by : Peter Daalmans, Configuration Manager MVP (info@configmgrblog.com) # Script version : v0.3 # Release date : 02/18/2014 # # v0.1 Release date : 01/25/2013 # Description: # # This script can be used to delete in Active Directory deleted devices. # This script will not delete the discovered Mobile Devices, manual added # devices or devices that resides in another domain or workgroup. # # How to use it: # # Supply the site code, installation drive, location of the log files and the # name of the domain. # # $sitecode = "<sitecode>:" # $sitecode = "S01:" # $installdrive = "<ConfigMgr Admin Console installation>" # $installdrive = "C:" # $loglocation = "<loglocation>" # $loglocation = "D:\Logfiles\" # $localdomain = "<domainname>" # $localdomain = "ConfigMgrLab" # $maxdevices = <maximum number of devices in your ConfigMgr environment> # $maxdevices = 2000 # # Check for more Configuration Manager information my blog: http://configmgrblog.com # # Create a scheduled task and run a commandline like this: # C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe e:\Scripts\RemoveDeletedDevicesFromConfigMgr2012SP1.ps1 -ExecutionPolicy Unrestricted # # New in v0.2: # # - Ability to set the Maximum Query Result Size of ConfigMgr 2012 SP1, by default this is 1000 items # - Fixed little bug while searching in AD for objects give back a number higher than 1. (more AD objects with the same name) # Fix in v0.3: # - Due lack of capitals in properties some device values where not available. # # Attention: Always test this script in a representative Lab environment first. # The script is provided “AS IS” with no warranties. # $sitecode = "S01:" $installdrive = "C:" $loglocation = "C:\Program Files\Microsoft Configuration Manager\Logs\" $localdomain = "hqsccm.com" $maxdevices = 200 Function Write-Log{ ##---------------------------------------------------------------------------------------------------- ## Function: Write-Log ## Purpose: This function writes trace32 log fromat file to user desktop ## Function by: Kaido Järvemets Configuration Manager MVP (http://www.cm12sdk.net) ##---------------------------------------------------------------------------------------------------- PARAM( [string]$Message, [int]$severity, [string]$component ) $TimeZoneBias = Get-WmiObject -Query "Select Bias from Win32_TimeZone" $Date= Get-Date -Format "HH:mm:ss.fff" $Date2= Get-Date -Format "MM-dd-yyyy" $type=1 "<![LOG[$Message]LOG]!><time=$([char]34)$date+$($TimeZoneBias.bias)$([char]34) date=$([char]34)$date2$([char]34) component=$([char]34)$component$([char]34) context=$([char]34)$([char]34) type=$([char]34)$severity$([char]34) thread=$([char]34)$([char]34) file=$([char]34)$([char]34)>"| Out-File -FilePath "$loglocation\Deleted-Devices-$Date2.Log" -Append -NoClobber -Encoding default } Import-Module ActiveDirectory IF(test-path ($installdrive + "\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin")) { Import-Module ($installdrive + "\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1") } ELSE {IF(test-path ($installdrive + "\Program Files\Microsoft Configuration Manager\AdminConsole\bin")){ Import-Module ($installdrive + "\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1") } ELSE { Write-Log -Message "ConfigMgr 2012 SP1 Admin console not found!" -severity 1 -component "Error" } } Set-Location $sitecode Set-CMQueryResultMaximum -Maximum $maxdevices $Computers = Get-CMDevice -CollectionName "All Systems" | ForEach-Object {$_.Name} Set-Location AD: for( $n = 0; $n -le $Computers.count -1; $n++ ) { IF(( $Computers[$n] -ne "x64 Unknown Computer (x64 Unknown Computer)" ) -And ($Computers[$n] -ne "x86 Unknown Computer (x86 Unknown Computer)")) { $comp = $Computers[$n] $comp = $comp.ToUpper() $searcher = ([adsisearcher]"samAccountName=$comp*") $rtn = $searcher.FindAll() IF($rtn.count -eq 0) { Set-Location $sitecode $tempdom = Get-CMDevice -name $Computers[$n] | ForEach-Object {$_.Domain} $resourcetype = Get-CMDevice -name $Computers[$n] | ForEach-Object {$_.ResourceType} $devicetype = Get-CMDevice -name $Computers[$n] | ForEach-Object {$_.DeviceType} if (($tempdom -eq $localdomain) -And ($resourcetype -eq "5") -And ($devicetype -eq $null) ){ Write-Log -Message "Deleting device from ConfigMgr 2012 - $Comp deleted" -severity 3 -component "Cleanup" # Remove-CMDevice -name $comp -force } ELSE { IF(($tempdom -ne $localdomain) -And ($tempdom -ne $null) -And ($devicetype -eq $null)) { Write-Log -Message "Preserving device in ConfigMgr 2012 - $Comp not deleted, member of other domain or workgroup." -severity 1 -component "Cleanup"} IF(($tempdom -eq $null) -And ($devicetype -eq $null)) { Write-Log -Message "Preserving device in ConfigMgr 2012 - $Comp not deleted, manually added or mobile device." -severity 1 -component "Cleanup"} IF($devicetype -ne $null) { Write-Log -Message "Preserving device in ConfigMgr 2012 - $Comp not deleted, mobile device." -severity 1 -component "Cleanup"} } } } }
  3. Dear Peter, I have modified this script it doesn't work properly...
  4. Dears, We have 400 computers deleted from active directory but still exist in SCCM, I can't go to delete 400 computers manually because it will take time, kindly I need quick way either script to remove those deleted computers in SCCM. Thanks..
  5. I did check box restart too, but I did I went client setting and I made new policy to decrease the time of restart to after 20 min restart the machine. So the server will be restart after 20 min when the update is finished..
  6. The configuration in type of deployment "Required" and checked system restart also.
  7. Dears, ​ we have almost 170 Windows ser​ver machines in our company and I wants to deploy windows updates through WSUS in SCCM 2012, I have made a group update packages an wants to deploy to server machines, but I made a schedule for start time and end time because of the servers are critical and I have to know the restart time, and I want to restart automatically start when the updated install by using restart required in deployment configuration, but when the update installed on the machines the machines not automatically restart and the message said restart required, please any advice to enforce restart automatically not manually. Thanks..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.