venerdì 29 luglio 2011

Remotely register DLL libraries

Hi all,
we have an application here around the network in quite all the clients that stops working when we deploy Office2010 as a dll file got missing on the client itself.

The fastest solution is to copy the dll back and to register it again.

If you want to do it remotely, and I don't mean with remote desktop, you can do it like this:

Prerequisites:
- You are logged on your pc with a user with admin rights on the target machine
- you already downloaded PSTOOLS from here:
http://technet.microsoft.com/it-it/sysinternals/bb897553.aspx

and have psexec command ready to be run on the disk

(I've already remotely copied the dll file to the c:\windows\system32 on the target machine)

1. open the command prompt
2. change to the psexec directory
3. submit this command:

psexec \\pcname cmd

A command prompt appears on your pc, but it is executing on the target machine (named pcname) !

submit the command to register the dll, but silently because we don't want any message on the target (message that the user will not see anyway as we are executing in a different context):

regsvr32 /s mylibrary.dll

/s  is for "silent"
mylibrary.dll is the .dll to be registered

type

exit

to close the remote command prompt and then exit again to close local prompt

that's all, the application is now  working again :)

P.S: I used it logged on my pc with a user with admin rights on the target, but if you are not, you could try it with the switches:

-u user -p password

that should do the job (not tried)

bye
Digger

martedì 26 luglio 2011

SCCM 2007 - Fill collection from text file (import machine names)

Hi all,
today I was trying to fill a collection in SCCM2007 importing the machines name from a text file I produced manually using Excel due to some manual work on them (filtering, manual check and so on).

I first tried to import them using the "right-click-tool-menu" on the collection itself.
At first it seems the right way to do it but then I noticed this introduced some strange behaviour in the collection as when you want to edit the collection (right click, properties) you notice that some entries are EMPTY!
So you don't know what you are going to remove...

Very bad..
So I tried other ways, also powershell scripts.
But I was not very satisfied.

So at the end I found my way, ok, not the best one probably, but it does the job.

The way is to create a query in the collection where you put the machine list like this:

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System  where  SMS_R_System.Name in   ( "PCNAME001" , "PCNAME002" , "PCNAME003" )

Ok, it works.
The problems now are two from my point of view.

1. it is a little bit boring to write the query manually putting all the machine names when I have it in excel and I could do a copy & paste
2. let's say in the future I need to modify the collection adding or removig some machine... not very easy to do

So I found my way also on this, 15 minutes and I wrote this small but useful application in VB.NET:







I write (paste) the machine list on the left, click the upper button and I obtain the query to paste in SCCM.
If I have to modify an existing collection, I copy and paste the query from SCCM to the right textbox and click the bottom button and on the leftI obtain the machine list, then I can edit it adding and removing, click the upper button again and I have the new query to pase in SCCM

For sure there are other tools/ways around, but for what I have to do, this is a good solution for me :)

bye
Digger