?
Solved

Script User Profile Changes

Posted on 2011-10-31
3
Medium Priority
?
500 Views
Last Modified: 2012-05-12
I need to change the session limits option on a large number of user profiles (370+ users). Is there a way to script this so that I can put the user profiles that I want changed into a file or something and then reference that in the CHGUSRPRF command?

I would really rather not do that many manual user profile changes...

I appreciate any help!
0
Comment
Question by:Matthew Roessner
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
_b_h earned 2000 total points
ID: 37057656

Create a list of all users on the system in file USERS in library MYLIB using:
DSPUSRPRF USRPRF(*ALL) OUTPUT(*OUTFILE) OUTFILE(MYLIB/USERS)

Edit this list using SQL or DFU so that it contains only the ones that you want.

Create CL program using the following source:
PGM                                                        
DCLF MYLIB/USERS                                              
NEXTUSER:                                                  
             RCVF                                          
             MONMSG (CPF0864) EXEC(DO) /* END OF FILE */  
                GOTO ENDOFFILE                            
                ENDDO                                      
             CHGUSRPRF &UPUPRF LMTDEVSSN(*YES)            
             GOTO NEXTUSER                                
ENDOFFILE:                                                
             ENDPGM                                      

Rather than edit the list, you might be able to come up with logic that identifies those 370 users. For example, if they are in group EASTERN and don't start with the letter "Q":

PGM                                                        
DCLF MYLIB/USERS                                              
NEXTUSER:                                                  
             RCVF                                          
             MONMSG (CPF0864) EXEC(DO) /* END OF FILE */  
                GOTO ENDOFFILE                            
                ENDDO
             IF (&UPGRPF *EQ 'EASTERN   ' +            
            *AND %SST(&UPUPRF 1 1) *NE 'Q') THEN(DO)  
                CHGUSRPRF &UPUPRF LMTDEVSSN(*YES)      
                ENDDO                                  
             GOTO NEXTUSER                                
ENDOFFILE:                                                
             ENDPGM                                        

Consider replacing CHGUSRPRF with SNDPGMMSG &UPPRF for testing purposes.

To get a list of fields in the file, use Display File Field Description:
DSPFFD FILE(MYLIB/USERS)

Hope this helps! Post back any questions.
Barry
0
 
LVL 1

Author Closing Comment

by:Matthew Roessner
ID: 37057672
Thanks Barry. That is exactly what I was looking for!
0
 
LVL 13

Expert Comment

by:_b_h
ID: 37057704
You're welcome.
Thanks for the grade and the points!
Post back if you need any help tweaking the script.
Barry
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the below post we have mentioned the best hosting type for startups. Also, check out some of the superlative web hosting companies that are proposing affordable web hosting solutions to host your startup website.
Social messanging services like WhatsApp and Facebook can help businesses in ways that many owners don't even imagine, giving new opportunities to connect with customers. Discover some of the most innovative things they can do for your company.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question