Need help writing script to change version control for all document libraries in all sites
Hello,
I found this script, http://get-spscripts.com/2010/10/changing-sharepoint-list-settings-using.html that
changes versions control for a document library. However, many sites have many document libraries with different names. The script below just changes a the settings to a document library that is named "Shared Documents", but does not
change one if its named something else. How can change the script to loop through all document libraries so their settings are changed?
$site = Get-SPSite http://site
$listName = "Shared Documents"
#Walk through each site in the site collection
$site | Get-SPWeb |
ForEach-Object {
#Get the list in this site
$list = $_.Lists[$listName]
#Create a version each time you edit an item in this list (lists)
#Create major versions (document libraries)
$list.EnableVersioning = $true
#Create major and minor (draft) versions (document libraries only)
$list.EnableMinorVersions = $true
#Keep the following number of versions (lists)
#Keep the following number of major versions (document libraries)
$list.MajorVersionLimit = 7
#Keep drafts for the following number of approved versions (lists)
#Keep drafts for the following number of major versions (document libraries)
$list.MajorWithMinorVersionsLimit = 5
#Update the list
$list.Update()
#Dispose of the site object
$site.Dispose()
Paul
Sorry, I agree. It will update Style Library and other out of the box ones. Include the library titles in a collection and run the update against them provided these libraries are common across all sites. If not, you will have to first get an extract of
all such libraries in all sites say in a CSV file and then update the script below to refer to the CSV records.
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction Stop;
#List of Libraries to be updated.
$Libraries = @("Shared Documents","My Document Library");
$spAssgn = Start-SPAssignment;
$site = Get-SPSite http://site -AssignmentCollection $spAssgn
#Walk through each site in the site collection
$site | Get-SPWeb -Limit ALL -AssignmentCollection $spAssgn |
ForEach-Object {
#Enumerate through all document libraries
$_.Lists|Where{$_.BaseTemplate -eq "DocumentLibrary" -and $Libraries -contains $_.Title}|Foreach-Object{
#Get the list in this site
$list = $_;
#Create a version each time you edit an item in this list (lists)
#Create major versions (document libraries)
$list.EnableVersioning = $true
#Create major and minor (draft) versions (document libraries only)
$list.EnableMinorVersions = $true
#Keep the following number of versions (lists)
#Keep the following number of major versions (document libraries)
$list.MajorVersionLimit = 7
#Keep drafts for the following number of approved versions (lists)
#Keep drafts for the following number of major versions (document libraries)
$list.MajorWithMinorVersionsLimit = 5
#Update the list
$list.Update()
Stop-SPAssignment $spAssgn;
This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.
Similar Messages
-
Need help writing script for Digital DAQ
Hello,
I am trying to write an aquisition program for digital input coming from a hall sensor. I will be passing a magnet over a hall sensor on a motor and want to record the number of rotations. I have pasted together a script based on various websites, but it isn't functioning the way I want. I would like to be able to collect data points indefinately, or fixed, and then print out the resulting count. I have attepted to use the ctypes wrapper in Python. The NI functions remain unchanged though, so if you don't know Python it shouldn't be a problem to read. I am using a NI PCI-6503.
NI PCI-6503
NI PCI-6503
NI PCI-6503
The code:
# C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Acq-Int Clk\Acq-IntClk.c
import ctypes
import numpy
nidaq = ctypes.windll.nicaiu # load the DLL
# Setup some typedefs and constants
# to correspond with values in
# C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h
# the typedefs
int32 = ctypes.c_long
uInt32 = ctypes.c_ulong
uInt64 = ctypes.c_ulonglong
float64 = ctypes.c_double
TaskHandle = uInt32
# the constants
DAQmx_Val_ChanForAllLines = int32(0)
def CHK(err):
"""a simple error checking routine"""
if err < 0:
buf_size = 200
buf = ctypes.create_string_buffer('\000' * buf_size)
nidaq.DAQmxGetErrorString(err,ctypes.byref(buf),buf_size)
raise RuntimeError('nidaq call failed with error %d: %s'%(err,repr(buf.value)))
# initialize variables
taskHandle = TaskHandle(0)
max_num_samples = 1000
# array to gather points
data = numpy.zeros((max_num_samples,),dtype=numpy.float64)
# now, on with the program
CHK(nidaq.DAQmxCreateTask("",ctypes.byref(taskHandle)))
CHK(nidaq.DAQmxCreateDIChan(taskHandle,'Dev1/port1/line1',"", DAQmx_Val_ChanForAllLines))
CHK(nidaq.DAQmxStartTask(taskHandle))
read = int32()
CHK(nidaq.DAQmxReadDigitalU32(taskHandle,int32(-1),float64(1),DAQmx_Val_GroupByChannel,data.ctypes.data,max_num_samples,ctypes.byref(read),None))
print "Acquired %d points"%(read.value)
if taskHandle.value != 0:
nidaq.DAQmxStopTask(taskHandle)
nidaq.DAQmxClearTask(taskHandle)
print "End of program, press Enter key to quit"
raw_input()
This script returns "Acquired 1 points" immediately, regardless of how many times the hall sensor has been switched.
I apologize for the sloppy code, but I understand very little of the underlying principles of these DAQ functions, despite reading their documentation. Seeing as how the code does not return an error, I am hoping there is just a minor tweak or two that will be farily obvious to someone with more experience.
ThanksHey Daniel,
Most of this script is from http://www.scipy.org/Cookbook/Data_Acquisition_with_NIDAQmx.
I needed to run the ReadDigitalU32 function in Python loop because my DAQ device did not support timed aquistion and I don't have LabView.
import numpy
import time
import ctypes
nidaq = ctypes.windll.nicaiu # load the DLL
# Setup some typedefs and constants
# to correspond with values in
# C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h
# the typedefs
int32 = ctypes.c_long
uInt32 = ctypes.c_ulong
uInt64 = ctypes.c_ulonglong
float64 = ctypes.c_double
TaskHandle = uInt32
# the constants
DAQmx_Val_Cfg_Default = int32(-1)
DAQmx_Val_Volts = 10348
DAQmx_Val_Rising = 10280
DAQmx_Val_FiniteSamps = 10178
DAQmx_Val_GroupByChannel = 0
DAQmx_Val_ChanForAllLines = int32(0)
# initialize variables
taskHandle = TaskHandle(0)
max_num_samples = 10000
data = numpy.zeros((max_num_samples,),dtype=numpy.float64)
read = uInt32()
bufferSize = uInt32(10000)
def CHK(err):
"""a simple error checking routine"""
if err < 0:
buf_size = 200
buf = ctypes.create_string_buffer('\000' * buf_size)
nidaq.DAQmxGetErrorString(err,ctypes.byref(buf),buf_size)
raise RuntimeError('nidaq call failed with error %d: %s'%(err,repr(buf.value)))
# Start up DAQ
CHK(nidaq.DAQmxCreateTask("",ctypes.byref(taskHandle)))
CHK(nidaq.DAQmxCreateDIChan(taskHandle,"Dev?/port?/line?","", DAQmx_Val_ChanForAllLines))
CHK(nidaq.DAQmxStartTask(taskHandle))
#initialize lists and time 1
t1 = time.time()
times = []
points = []
while True:
try:
CHK(nidaq.DAQmxReadDigitalU32(taskHandle,int32(-1),float64(1),
DAQmx_Val_GroupByChannel,data.ctypes.data,uInt32(2*bufferSize.value)
,ctypes.byref(read), None))
t2 = time.time()
#data[0] is the position in the numpy array 'data' that holds the value aquired
#from your device
points.append(data[0])
times.append(t2 - t1)
t1 = time.time()
#Choose time interval between data aquisition
time.sleep(.02)
except KeyboardInterrupt:
break
#process the lists of points and time intervals as you so choose
Thanks for the help!
Paul -
Need help writing script to have dbms_stats delete and collect schema
I am working on a script to collect stats for Oracle 8i with dbms_stats.
Since the bug in Oracle 8i requires me to first delete stats for all tables in the schema and
then to re-run dbms_stats to collect the stats, how can I write a script to do the cleanup and collection stats process for Oracle 8i on Unix?
ScottSomething like this (Linux) :
$ cat stats.sh
. $HOME/.bash_profile
ORACLE_SID=orcl; export ORACLE_SID
echo "Deleting statistics..."
sqlplus -s "/ as sysdba" << EOF
exec dbms_stats.delete_schema_stats('SCOTT');
exit
EOF
echo "Gathering statistics..."
sqlplus -s "/ as sysdba" << EOF
exec dbms_stats.gather_schema_stats('SCOTT',cascade=>true);
exit
EOF
$ ./stats.sh
Deleting statistics...
PL/SQL procedure successfully completed.
Gathering statistics...
PL/SQL procedure successfully completed.
$ Change .bash_profile with .profile if you are using korn shell or bourne shell. -
Need help on scripting to skip exchange databse for checking
Hello, There is a default script in exchange in 2010 to check the DB replication by default it will check for all BUt if we need to skip any of the DB i need to mentioned the same; so for one DB is working fine but when adding more then one its not
working and alert is getting generated
# Skip checking the "default" mailbox databases. eg: Mailbox Database 0017891750
# Specify $null (or an empty string) if you don't want to skip any databases.
[Parameter(ParameterSetName="Server")]
[string] $SkipDatabasesRegex = "^Mailbox Database \d{10}$|^ABC-DB",
## the BOLD for one Database to skip what if i need to need to skip more then one database , i tried adding the below but seems to be it is not working ?
#Do i need to user comma, or any other symbol to mentioned two DB's
^ABC-DB,HOME-DB", OR ^ABC-DB,^HOME-DB",
#I tried the below but it is not working
# Skip checking the "default" mailbox databases. eg: Mailbox Database 0017891750
# Specify $null (or an empty string) if you don't want to skip any databases.
[Parameter(ParameterSetName="Server")]
[string] $SkipDatabasesRegex = "^Mailbox Database \d{10}$|^ABC-DB|^HOME-DB",sorry but able to make the changes now and its working as expected .thanks
[string] $SkipDatabasesRegex = "^Mailbox Database \d{10}$|(ABC-DB)|(HOME-DB)",
My point is that you are not supposed edit the supplied scrip but are supposed to pass in your own parameters. THe default behavior is set by the author by design.
Since you have not supplied us with a copy of the script it is not possible to understand exactly what is intended.
Normally we would mark the supplied answer as the "answer" and not your response to that. THe answr was that you need to use a correct RegEx and not just place an arbitrary "OR" in the RegEx.
¯\_(ツ)_/¯ -
Version control for applications
Can someone point me to resources on version control for (web) applications.
I read some documentation at cvshome.org, what I understood is that I need a Server that handles version control and a client to interact with the server to do various tasks.
I have windows 2000 pro. OS. Can someone tell me what all tools I need so that I can use version controlling for my applications.
What (free) servers and clients are available and which ones are better.
Thank you all for your time and informationCVS is one of the best version control systems, free or otherwise.
The for-fee leaders that I know of are PVCS, M$ Visual Source Safe, Rational/IBM's Clear Case. All three will require a server and separate clients.
CVS is a great choice for any kind of app. Stick with that. -
I need help writing a script that finds the first instance of a paragraph style and then changes it
I need help writing a script that finds the first instance of a paragraph style and then changes it to another paragraph style. I don't necessarily need someone to write the whole thing, by biggest problem is figuring how to find just the first instance of the paragraph style. Any help would be greatly appreciated, thanks!
Hi,
Do you mean first instance of the paragraph style
- in a chosen story;
- on some chosen page in every text frames, looking from its top to the bottom;
- in a entire document, looking from its beginning to the end, including hidden layers, master pages, footnotes etc...?
If story...
You could set app.findTextPreferences.appliedParagraphStyle to your "Style".
Story.findText() gives an array of matches. 1st array's element is a 1st occurence.
so:
Story.findText()[0].appliedParagraphStyle = Style_1;
//==> this will change a paraStyle of 1st occurence of story to "Style_1".
If other cases...
You would need to be more accurate.
rgds -
Need Help Writing Server side to submit form via API
Hey
I need help writing a serverside application to submit
information via API to a separate server.
I have a client that uses constant contact for email
campaigns. We want to add to her website a form taht submits the
information needed to subscribe to her email list, to constant
contact via API.
FORM.asp :: (i got this one under control)
name
email
and submits to serverside.asp
SERVERSIDE.ASP
In serverside.asp i need to have
the API URL
(https://api.constantcontact.com/0.1/API_AddSiteVisitor.jsp)
username (of the constant contact account)
password (of the constant contact account)
name (submited from form.asp)
email (submitted from form.asp)
redirect URL (confirm.asp)
Can anyone help get me going in the right direction?
i have tried several things i found on the net and just cant
get anyone to work correctly.
One main issue i keep having is that if i get it to submit to
the API url correctly - i get a success code, it doesnt redirect to
the page i am trying to redirect to.
ASP or ASP.NET code would be find.
THANKS
sam> This does require server side programming.
> if you dont know what that is, then you dont know the
answer to my question. I
> know what i need to do - i just dont know HOW to do it.
If you are submitting a form to a script on a remote server,
and letting
that script load content to the browser, YOU have no control
over what it
loads UNLESS there is some command you can send it that it
will understand.
No amount of ASP on your server is going to change what the
remote script
does.
http://www.constantcontact.com/services/api/index.jsp
they only allow their customers to see the instructions for
the API so i
can't search to see IF there is a redirect you can send with
the form info.
But posts on their support board say that there is.
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/ -
Need help writing host program using LabView.
Need help writing host program using LabView.
Hello,
I'm designing a HID device, and I want to write a host program using National Instrument's LabView. NI doesn't have any software support for USB, so I'm trying to write a few C dll files and link them to Call Library Functions. NI has some documentation on how to do this, but it's not exactly easy reading.
I've written a few C console programs (running Win 2K) using the PC host software example for a HID device from John Hyde's book "USB by design", and they run ok. From Hyde's example program, I've written a few functions that use a few API functions each. This makes the main program more streamlined. The functions are; GetHIDPath, OpenHID, GetHIDInfo, Writ
eHID, ReadHIC, and CloseHID. As I mentioned, my main program runs well with these functions.
My strategy is to make dll files from these functions and load them into LabView Call Library Functions. However, I'm having a number of subtle problems in trying to do this. The big problem I'm having now are build errors when I try to build to a dll.
I'm writing this post for a few reasons. First, I'm wondering if there are any LabView programmers who have already written USB HID host programs, and if they could give me some advice. Or, I would be grateful if a LabView or Visual C programmer could help me work out the programming problems that I'm having with my current program. If I get this LabView program working I would be happy to share it. I'm also wondering if there might already be any USB IHD LabView that I could download.
Any help would be appreciated.
Regards, George
George Dorian
Sutter Instruments
51 Digital DR.
Novato, CA 94949
USA
[email protected]
m
(415) 883-0128
FAX (415) 883-0572George may not answer you. He hasn't been online here for almost eight years.
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice -
Need help writing small program!
Hi. I'm learning Java programming, and I need help writing a small program. Please someone help me.
Directions:
Create a program called CerealCompare using an if-then-else structure that obtains the price and number of ounces in a box for two boxes of cereal. The program should then output which box costs less per ounce.class CerealCompare {
public static void main(String[] args) {
// your code goes here
}Hope that helps.
P.S. Java does not have an if-then-else statement. -
Needs help to know the different versions of forms with their compatibility
Needs help to know the different versions of forms with their compatibility with different databases and operating systems.
Kindly give the details or any suitable link for the same.
please consider it as on urgent basis.
regards,
rajeshRajesh,
the certification matrix is available on metalink.oracle.com. You need a support contract to access this information.
Frank -
Version Control for Oracle Reports and Java
Hi
I have a Reports and Java development enviroment and I need version control for both. In JDeveloper there is only support for CVS and SVN. Does report have support for CVS and SVN?. What can I choose to offer Java and Reports version control?
Regards,
Néstor BoscánHello,
You might find neXtep Designer helpful, depending on what you need. It is a free database development environment based on the concept of version control. You will work in a dedicated version control repository in which you can import any existing database through reverse synchronization. Once imported, you will gain control over the lifecycle of your database model all along your developments. The tool will generate SQL scripts resulting from the delta between any 2 versions, allowing you to automate SQL generation. It also provide a delivery mechanism and an installer program which can automate deployment of the changes on a target database.
The product is based on the Eclipse platform and provides features like graphical data model, dependency management, SQL clients, powerful SQL editors for stored code development and currently supports Oracle, MySql and PostgreSql. You will find more information here :
http://www.nextep-softwares.com
Also have a look at the WIKI for more detailed information about the product, the concepts and the reasons why we created neXtep.
Hope this helps,
Christophe -
Need help using WEB module in Lightroom 2 for .mac/mobile me accounts
Hello,
I need help in finding the Server path information for Lightroom 2. I am trying to use the Web module of Lightroom and build a website and instead of going through another hosting service, I want to use my Mobile ME account, can't I do that?
I have the user name and password obviously but what is the server path, protocol, path?
Help please!
Thanks
RayFor those Mac Users using iWeb, MobileMe, and Lightroom 2, here are step-by-step instructions on how to create a web gallery in Lightroom, upload the gallery to MobileMe, and finally, how to link the uploaded files to the wesite you created in iWeb.
1. In the Lightroom Library module, create a collection of photos you want to display in your web gallery. For illustration purposes, we will call your collection Sunsets. Once created, it will be listed under Collections in the left panel of Lightroom.
2. Switch to the Lightroom Web module and select the Sunsets collection (from the panel on the left of the screen.)
3. Chose whichever template you like (from the list of Templates in the left panel).
4. Fine tune the appearance of the gallery using the controls in the right hand panel of Lightroom 2.
5. When you are satisfied with the gallery’s appearance, use your keyboard to type Command-S. That will save your template settings (give it a unique name when saving).
6. Open up Finder on your Mac. Inside your username folder, create a new folder… I'll call it Web Files. (You can choose any name you like, and locate the file anywhere on your Mac HD.) You have just created the folder username/Web Files.
7. Back in the Lightroom Web module, chose Export, at the bottom of the right panel, and export your gallery to the folder you just made (e.g. export to username/Web Files). By doing so, you will have created /username/Web Files/Sunsets.
8. Once again open Finder on your Mac. Go to /username/Web Files/Sunsets and you will see 3 files in the Sunsets folder: bin, index.html, and resources.
9. Open a second Finder window and in it, click on your iDisk icon. You will soon see all of the files on your iDisk.
10. In iDisk, click on the folder called /Web. You will now see the /Sites folder inside the /Web folder. I.e., /Web/Sites.
11. Drag the Sunsets file from your Mac HD to the /Sites folder on your iDisk. E.g, drag Sunsets from /username/Web Files/Sunsets on your Mac HD to the /Sites folder in iDisk /Web/Sites. The Sunsets folder (and the three files it contains) will now upload to your iDisk on MobileMe.
12. Open iWeb on your Mac. Add a new page to your website. Call it “Galleries,” or anything you like. (You can also use an existing page if you wish.)
13. On that “Galleries” web page (or on an existing web page), create a picture icon, or a word, or a symbol, or anything else that you will activate as a hyperlink to your iDisk web files - specifically, you will link it to the Sunsets folder you just uploaded to iDisk.
14. Activate the hyperlink in iWeb’s Inspector. In the URL box, type:
http://web.me.com/username/Sunsets (Don’t forget to substitute your name for “username” and the name of your gallery for “Sunsets.”)
15. Save your website in iWeb, and then publish your site.
You will NOT see your gallery in iWeb – you will see only the link to the gallery that you uploaded to iDisk.. To view your gallery, either make hyperlinks active, using the Inspector in iWeb and click on he link to the gallery, or visit your website on the internet. If you want to edit your gallery, you will have to do that in Lightroom… then repeat steps 7 – 11. You cannot edit your gallery in iWeb, but you can use iWeb to change the appearance of the link to your gallery, or to change it’s location within your website. -
Change Message Control for Customer Master data
Hi Friends,
I have to choose/populate a message when the user is about to create an already existing customer.
In SPRO --> Financial Accounting --> Accounts Receivable and Accounts Payable --> Customer Accounts --> Master Data --> Preparations for creating customer master data --> "change message control for customer master data" ...
OK...
When u click this it goes into Change View "message control by User" Overview screen wherein u can insert new messages and texts and the type of message ....
Now .....
I want to display the 145th message (F4 help of the Message column) ..... it picks up the text "Customer found with same address;check"..... with Online mesasage type 'I' and batch type 'I' and with standard type '-' ..
I want to have the same message with message types 'E','E', and 'I' respectively.......
How is this possible (or) what should i do to meet my requirement :-|
Expecting ur answers
Thanks in advance ........
Cheers,
R.Kripa.Hey yes it is not possible (as of now
I ve met the requirement by just using message statement in the program itself ............
My requirement is met but still if anyone knows about this do answer / reply
Thanks
Cheers,
R.Kripa. -
Version Control for BUSINESS OBJECTS repository
Hi,
Do we have any version control for business objects repository?
ThanksHi
I am hoping someone can answer my Version Control queries. The LCM document is limited in its detail on VM.
I am currently testing the BO LCM 3.1 and while it appears very easy to use especially for promotion, the Version Control Manager seems to be lacking in controls and a clear promotion path from dev to test to uat to prod.
We have set up 2 identical environments for UAT and PROD.
And using the Version Control part of LCM creating version control for a universe.
Logged into VM in UAT
We have selected a universe
Added it to VM
Made a change to the universe in Designer
Exported it
Then Checked it in
Can now see 2 versions in the history and the VMS Version. All good
I then click on swap system and log into PROD
The VM history is also there in PROD
I have a number of concerns and questions and can't seem to find the solution to them anywhere.
1. VM seems to be lacking a controlled process from all the environments. Basically we want to deploy following this path;
Dev - Test - UAT - PROD
There does not seem to be any controls or security which would stop you from GET VERSION from the DEV environment and putting that straight into PROD. Obviously we would not want that to happen.
We would only want to GET VERSION from UAT
Similarly for UAT We would only want to GET VERSION from TEST
And for TEST We would only want to GET VERSION from DEV.
Granted, we currently only have 2 identical environments.
But Is there controls that would stop you when in PROD from getting versions from any other system other than UAT?
Also is there any reason why no promotion is required when using VM.
This seems to negate the Promotion Function of the LCM
Any advise would be greatly appreciated with this.
Many thanks
Eilish -
Sir,
I have activated version control as well as fields relevant for po but it is not reflecting
ply help me how can i reconfigure it
regards
ameyHello Amey,
Pl. activate version control for PO in SPRO. Steps are as follows
SPRO/MM/Purchasing/Version Management/Set Up Version Management for External Purchasing Documents then Add new entry for the Purchase order document type and respective Purch. organisation and put a tick in the text box.
This would solve your problem.
With regards.
Sanjay
Maybe you are looking for
-
I want to connect my iMac 21.5 mid 2011 to the tv
how can i connect my imac to an hdmi plug from the tv. do i use a thunderbolt cable and what adaptor can i use?
-
Hi how to take report of sto withou delivery,i created po doc type ub for 6 qty .goods issue given 351 mvt type 1 qty balance 5qty avl,in me2m i tried select enter material scope of list alv,doc type ub,selection parameters wa351 execute report show
-
We often need to send files downloaded from irm-enabled libraries of sharepoint to our clients who have no access to our rms server enviroment via e-mail or OA. Now we have to remove these files' irm setting mannually using the account who have ove
-
Hi Experts I have run distribution run for allocating the distrebuted expenses from one cost center (X) to some other cost centers. Than I have realized that one GL posting transaction was done by mistake for this cost center X, and so was distrebute
-
PROXY. What optimisations are there?
We have a fairly big installation of proxies and masters which I am testing at the moment. Using SLAMD. On a simple LDAP Auth test, I am seeing results that look like the following: LDAP client -> Proxy -> Master. 600ms+ when handling only 125 auths/