rdefino
asked on
How to move multiple systems to a collection in SCCM 2012
I'm trying to follow this link to move systems to a collection: http://henryhazot.wordpress.com/2013/10/31/sccm-2012-sp1-powershell-3-adding-computers-to-collection-from-file/
But I'm having trouble understanding where I put in my source & target collection.
I have hundreds of system to move and would to use a txt file with systems names to pull them out and put into another collection.
Could anyone please help?
But I'm having trouble understanding where I put in my source & target collection.
I have hundreds of system to move and would to use a txt file with systems names to pull them out and put into another collection.
Could anyone please help?
ASKER
No similarity at all. I have a specific list of systems that need to be moved. Seems the only way is a text or csv file.
Seems it can be done using this code from the web link, but I;m just having issues understanding it.
Seems it can be done using this code from the web link, but I;m just having issues understanding it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Where do I put the source and destination collection name, and what is the format of the txt file.
This is what has been confusing me?
thanks
This is what has been confusing me?
thanks
There is only destination collection the source is txt file with each computer name specified one by one in its own line.
Srv001
Srv002
Srv003
.
.
.
Srv001
Srv002
Srv003
.
.
.
ASKER
Is this were the destination collection name goes?
-collectionname $Mycollectionname -resourceid
-collectionname $Mycollectionname -resourceid
$CollectionName is a place holder for collection name
Refer to the code I posted before.
URDeviceCollection should be replaced with whatever collection name you have to import into.
Supply the location of txt file.
You need to do only these changes rest of the script will do its work
Refer to the code I posted before.
URDeviceCollection should be replaced with whatever collection name you have to import into.
Supply the location of txt file.
You need to do only these changes rest of the script will do its work
ASKER
I change the error action to see what was happening and I get this error:
Get-CMDevice : This command cannot be run from the current drive. To run this command you must first connect to a
Configuration Manager drive.
I did cd <sitename>
Then I change to the drive and folder the ps1 is stored. then I get the error.
Get-CMDevice : This command cannot be run from the current drive. To run this command you must first connect to a
Configuration Manager drive.
I did cd <sitename>
Then I change to the drive and folder the ps1 is stored. then I get the error.
Did you start powershell from the config mgr console? The error does not seems to be coming from the script
ASKER
Yes id id. They I had to run "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass" to turn of sign security error.
Then I changed to the e: drive, change into the folder and ran the ps1. I git the same error.
Then I changed to the e: drive, change into the folder and ran the ps1. I git the same error.
ASKER
I got it to work. I changed to cd sitename:
Then called the ps1 from there instead of changing to the drive.
Thanks for the help!
Then called the ps1 from there instead of changing to the drive.
Thanks for the help!
You can easily create a Query Rule collection based on some kind of criteria and more over this Query rule will be dynamic, you don't need to keep maintaining the collection everytime you add new system to network.