Using power shell function and SQL Table
I have a table holding file path of over 1 million documents. so like column one is documentID and column two is full file path.
Now, I want to get the file size of each of the documents. I have a function in power shell that gets the size of a file given file path.
My problem, is I do not know how to use that function and the table to get the size of each of the files(documents).
Help Much Appreciated!!
ebro
I am not clear with your questions sir. Do you mean the category this question belongs too? If so, may be some body could help redirect the question to the appropriate place.
So what category does this belong too CM12 or Powershell?
http://www.enhansoft.com/
Similar Messages
-
Hi,
Can anyone pls point me any link/ src code for deplyoing wsp using power shell. I know I can deploy it through Add-spsolution and install-spsolution, the issue is that, it will give "status - stuck in deploying scheduled..."
and i need to restart the sharepoint services - services.msc --> SP administration and timer services - and then i need to run the exceadmsvcjobs command to deploy / update the wsp successfully in solution store.
i mean, whats the power shell equivalent of these tasks. or anyone has already scripted these.
if i elaborate little bit, would like to know how to automatically Retract, Remove, Add and Deploy SharePoint 2010 WSP Solution Files with PowerShellok, i have found the same :
here its : hope this will help someone.
function wait4timer($solutionName)
$solutionName ="TestingWSP.wsp"
$solution = Get-SPSolution | where-object {$_.Name -eq $solutionName}
if ($solution -ne $null)
Write-Host "Waiting to finish soultion timer job" -ForegroundColor Green
while ($solution.JobExists -eq $true )
Write-Host "Please wait...Either a Retraction/Deployment is happening" -ForegroundColor DarkYellow
sleep 5
Write-Host "Finished the solution timer job" -ForegroundColor Green
try
# Get the WebApplicationURL
$MyWebApplicationUrl = "http://srvr:21778/";
# Get the Solution Name
$MywspName = "TestingWSP.wsp"
# Get the Path of the Solution
$MywspFullPath = "D:\myWorkspace\TestingWSP.wsp"
# Try to get the Installed Solutions on the Farm.
$MyInstalledSolution = Get-SPSolution | Where-Object Name -eq $MywspName
# Verify whether the Solution is installed on the Target Web Application
if($MyInstalledSolution -ne $null)
if($MyInstalledSolution.DeployedWebApplications.Count -gt 0)
wait4timer($MywspName)
# Solution is installed in atleast one WebApplication. Hence, uninstall from all the web applications.
# We need to unInstall from all the WebApplicaiton. If not, it will throw error while Removing the solution
Uninstall-SPSolution $MywspName -AllWebApplications:$true -confirm:$false
# Wait till the Timer jobs to Complete
wait4timer($MywspName)
Write-Host "Remove the Solution from the Farm" -ForegroundColor Green
# Remove the Solution from the Farm
Remove-SPSolution $MywspName -Confirm:$false
sleep 5
else
wait4timer($MywspName)
# Solution not deployed on any of the Web Application. Go ahead and Remove the Solution from the Farm
Remove-SPSolution $MywspName -Confirm:$false
sleep 3
wait4timer($MywspName)
# Add Solution to the Farm
Add-SPSolution -LiteralPath "$MywspFullPath"
# Install Solution to the WebApplication
#Install-SPSolution -Identity <SolutionName> -WebApplication <URLName> [-GACDeployment] [-CASPolicies]
install-spsolution -Identity $MywspName -WebApplication $MyWebApplicationUrl -GACDeployment #-FullTrustBinDeployment:$true -GACDeployment:$false -Force:$true
# Let the Timer Jobs get finishes
wait4timer($MywspName)
Write-Host "Successfully Deployed to the WebApplication" -ForegroundColor Green
catch
Write-Host "Exception Occuerd on DeployWSP : " $Error[0].Exception.Message -ForegroundColor Red
ref :
http://www.sharepointpals.com/post/How-to-Deploy-a-SharePoint-2013-Solution-(WSP)-in-the-Farm-using-PowerShell -
Using User Defined Function is SQL
Hi
I did the following test to see how expensive it is to use user defined functions in SQL queries, and found that it is really expensive.
Calling SQRT in SQL costs less than calling a dummy function that just returns
the parameter value; this has to do with context switchings, but how can we have
a decent performance compared to Oracle provided functions?
Any comments are welcome, specially regarding the performance of UDF in sql
and for solutions.
create or replace function f(i in number) return number is
begin
return i;
end;
declare
l_start number;
l_elapsed number;
n number;
begin
select to_char(sysdate, 'sssssss')
into l_start
from dual;
for i in 1 .. 20 loop
select max(rownum)
into n
from t_tdz12_a0090;
end loop;
select to_char(sysdate, 'sssssss') - l_start
into l_elapsed
from dual;
dbms_output.put_line('first: '||l_elapsed);
select to_char(sysdate, 'sssssss')
into l_start
from dual;
for i in 1 .. 20 loop
select max(sqrt(rownum))
into n
from t_tdz12_a0090;
end loop;
select to_char(sysdate, 'sssssss') - l_start
into l_elapsed
from dual;
dbms_output.put_line('second: '||l_elapsed);
select to_char(sysdate, 'sssssss')
into l_start
from dual;
for i in 1 .. 20 loop
select max(f(rownum))
into n
from t_tdz12_a0090;
end loop;
select to_char(sysdate, 'sssssss') - l_start
into l_elapsed
from dual;
dbms_output.put_line('third: '||l_elapsed);
end;
Results:
first: 303
second: 1051
third: 1515
Kind regards
TaoufikI find that inline SQL is bad for performance but
good to simplify SQL. I keep thinking that it should
be possible somehow to use a function to improve
performance but have never seen that happen.inline SQL is only bad for performance if the database design (table structure, indexes etc.) is poor or the way the SQL is written is poor.
Context switching between SQL and PL/SQL for a User defined function is definitely a way to slow down performance.
Obviously built-in Oracle functions are going to be quicker than User-defined functions because they are written into the SQL and PL/SQL engines and are optimized for the internals of those engines.
There are a few things you can do to improve function
performance, shaving microseconds off execution time.
Consider using the NOCOPY hints for your parameters
to use pointers instead of copying values. NOCOPY
is a hint rather than a directive so it may or may
not work. Optimize any SQL in the called function.
Don't do anything in loops that does not have to be
done inside a loop.Well, yes, but it's even better to keep all processing in SQL where possible and only resort to PL/SQL when absolutely necessary.
The on-line documentation has suggested that using a
DETERMINISTIC function can improve performance but I
have not been able to demonstrate this and there are
notes in Metalink suggesting that this does not
happen. My experience is that DETERMINISTIC
functions always get executed. There's supposed to
be a feature in 11g that acually caches function
return values.Deterministic functions will work well if used in conjunction with a function based index. That can improve access times when querying data on the function results.
You can use DBMS_PROFILER to get run-time statistics
for each line of your function as it is executed to
help tune it.Or code it as SQL. ;) -
hi,
i am having a visual studio custom solution having page layouts implemented. In that solution i am having 1 summary links web part and in that i have hard coded few links and this is deployed on ion dev and staging env.
Now, the issue is : yesterday, customer came to me and asking me to change the links from http://abc to
http://xyz/ in this summary links. can anyone pls throw some light,such that i can change this link using a power shell script. i know if i go the VS solution and change the link and redeploy [ update-spsolution
command] will work.
but if the links are changing regularly , chnaging the vs solution and redeploying is not a good practice.
if i elaborate li'l bit, i am adding the screen shot : i need to get the summary link column's value and need to update[ delete xisting one and add new ones ]
is there any way , i can change the links using power shell script?
i tried the belwo power shells cript to get the page in the page layouts :
$web = get-spweb
"http://siteurl"
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$pagesListName = $pubWeb.PagesListName
$defaultAspxFile = $pubWeb.GetPublishingPage("$pagesListName/mycustomhome.aspx")
$summaryLinkFieldValue = New-Object
Microsoft.SharePoint.Publishing.Fields.SummaryLinkFieldValue
// here am getting the NULL VALUE
can i get the summary links field correctly and delete / modify the same?
help is appreciated!
##$groupLink = New-Object
Microsoft.SharePoint.Publishing.SummaryLink("My group")
#$groupLink.IsGroupHeader = $true $summaryLinkFieldValue.SummaryLinks.Add($groupLink)Hi Shabeaut,
Could you tell us why do you want to add a link web part to the master page for all pages?
I tested that Summary Links web part (and other types of web parts) added in the master page under Quick Launch couldn't be edited when I edit the pages inherited from v4.master page, it looks by design.
Have you tried using the Quick Launch to add the link instead if you want to show links in all pages.
Thanks
Daniel Yang
TechNet Community Support -
New-CMGlobalCondition unable to create New script Condition using Power Shell
I am using config Manger 2012 and trying to use power shell cmdlet to create a new Global Condition using PowerShell but its not working for me using this
Do not understand how to use that command any idea.
New-CMGlobalCondition -DataType Boolean -DeviceType Windows -FilePath file.ps1 -Name test -ScriptLanguage PowerShell
Error comes as
New-CMGlobalCondition : No object corresponds to the specified parameters.
At line:1 char:1
+ New-CMGlobalCondition -DataType Boolean -DeviceType Windows -FilePath file.ps1 - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Confi...onditionCommand:NewGlobalConditionCommand) [New-CMGlobalCondition], I
temNotFoundException
+ FullyQualifiedErrorId : ItemNotFound,Microsoft.ConfigurationManagement.Cmdlets.AppModel.Commands.NewGlobalConditionCommandHi,
What's your version of SCCM? I ran this command line on SCCM 2012 R2 CU2.
It seems SCCM 2012 R2 CU2 fixed New-CMGlobalCondition cmdlet issue.
"The New-CMGlobalCondition cmdlet incorrectly requires use of the
-WhereClause parameter."
Description of Windows PowerShell changes in Cumulative Update 2 for System Center 2012 R2 Configuration Manager
Best Regards,
Joyce -
Create & Start UPS Service Using Power-Shell in SharePoint 2013
I want to know that is there a way to create a User Profile Synchronization Service using Power-Shell in a SharePoint 2013 Enterprise site? If so then how am I supposed to do that and start the User Profile Synchronization Service using the Power-Shell.
I'm seeking this help because the UPS service is stuck in Starting and both FIM Services are also not started but they are in Automatic start mode.
Could someone try to solve this matter.
Thanks,
regards,
Chiranthakastart it from powershell will not help you resolve the issue.
Try below articles:
http://myspexp.com/2011/04/28/user-profile-synchronization-servicehangs-on-starting-i-fixed-it/
troubleshoot this issue:http://www.harbar.net/articles/sp2010ups2.aspx
http://www.sharepointdiary.com/2012/09/user-profile-synchronization-service-stuck-at-starting.html#ixzz2aXArH7zX -
Using Power shell script how to hidden SharePoint existing features.
Hi Firends,
Using Power shell script how to hidden SharePoint existing features.
Please help me.
Thanks,
Tiru
TiruThe Hidden property is set within the solution, so you would need access to the source code in order to set it.
Trevor Seward
Follow or contact me at...
  
This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs. -
Can I use Reports Server Queue PL/SQL Table API to retrieve past jobs ?
Hi all,
Can I use Reports Server Queue PL/SQL Table API to retrieve past jobs using WEB.SHOW_DOCUMENT from Forms ?
I have reviewed note 72531.1 about using this feature and wonder if i can use this metadata to retrieve past jobs submitted by a user.
The idea would be to have a form module that can filter data from the rw_server_queue table, say, base on user running the form, and be able to retrieve past jobs from Report Server Queue. For this, one would query this table and use WEB.SHOW_DOCUMENT.
Is this possible ...?
Regards, Luis ...!Based on that metalink note and the code in the script rw_server.sql, I am pretty sure that by querying the table you would be able accomplish what you want... I have not tested it myself... but it looks that it will work... you have the jobid available from the queue, so you can use web.show_document to retrieve the output previously generated...
ref:
-- Constants for p_status_code and status_code in rw_server_queue table (same as zrcct_jstype)
UNKNOWN CONSTANT NUMBER(2) := 0; -- no such job
ENQUEUED CONSTANT NUMBER(2) := 1; -- job is waiting in queue
OPENING CONSTANT NUMBER(2) := 2; -- opening report
RUNNING CONSTANT NUMBER(2) := 3; -- running report
FINISHED CONSTANT NUMBER(2) := 4; -- job has finished
TERMINATED_W_ERR CONSTANT NUMBER(2) := 5; -- job has terminated with -
Activate design manager (sandbox) solution using power shell - SP2013
Hi All,
I have a design manager (sandbox) solution and deployed in site collection. I am trying to upload the new version using power shell.
Uninstall-SPUserSolution , Remove-SPUserSolution, Add-SPUserSolution and finally doing Install-SPUserSolution on that time i am getting the following error " Install-SPUserSolution : This file may not be moved, deleted,
renamed, or otherwise edited." kindly help me for this issue.
Regards,
SanthoshCan you please provide more details on your solution package? Did you use SharePoint Design Manager to create design package? If that is the case then if you read the following article it reads and
"In SharePoint 2013 you cannot uninstall an imported design package, and you should never attempt to deactivate a design package through the solution gallery."
I think if you read the article it might be helpful.
http://msdn.microsoft.com/en-us/library/jj862342.aspx
Amit -
Programmatically create SPGroups using power shell
hi,
I wanna create sp groups programmatically using power shell,
can anyone pls point me in the right direction.
i have gone through this code:
$GroupName = "mygrp1"
$owner =""
$member =""
$Description =""
$SPWeb.SiteGroups.Add($GroupName, "", "","")
$SPGroup = $SPWeb.SiteGroups[$GroupName]
$SPWeb.RoleAssignments.Add($SPGroup)
$SPWeb.Dispose()
just wanted to know whether should i add few code related with sproleassignments/ sproeldefintions etc we used to do in SP OM through c#
help is appreciated!There are two parts.
1. Adding a group to the site collection.
2. assigning permissions to the group.
The PS script given below first ensures if the group exists or not and then executes the logic. If the group already exists, then it will not add group the site. I would recommed to test it in Dev environment and then use in Prod.
$site=Get-SPSite $siteCollectionUrl
$rootSite=$site.RootWeb
$member=$rootSite.Users["User_Name"]
$user=$rootSite.Users["Other_User_Name"]
try
$grp=$rootSite.SiteGroups["Group Name"]
catch
if($grp -eq $null)
$rootSite.SiteGroups.Add("Group Name",$member, $user, "Group Description")
$grp=$rootSite.SiteGroups["Group Name"]
$roleDef=$rootSite.RoleDefinitions.GetByType([Microsoft.SharePoint.SPRoleType]::Contributor)
$roleAssigns=New-Object -TypeName Microsoft.SharePoint.SpRoleAssignment -ArgumentList $grp
$roleAssigns.RoleDefinitionBindings.Add($roleDef)
$rootSite.RoleAssignments.Add($roleAssigns)
$rootSite.Update()
Pradip T. ------------- MCTS(SharePoint 2010/Web)|MCPD(Web Development) https://www.mcpvirtualbusinesscard.com/VBCServer/paddytakate/profile -
How to get site permissions using power shell ?
Hello,
I require to get list of granted permissions ( Group/users ) which we see from Site Actions > Site Permissions.
would you please let me know how can I fetch the same using power shell ?
Thanks and Regards,
Dipti ChhatrapatiHello,
I have found the same using following script :
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#Define variables
$site = Get-SPSite "Site collection URL"
#Get all subsites for site collection
$web = $site.AllWebs
#Loop through each subsite and write permissions
foreach ($web in $web)
if (($web.permissions -ne $null) -and ($web.hasuniqueroleassignments -eq "True"))
Write-Output "****************************************"
Write-Output "Displaying site permissions for: $web"
$web.permissions | fl member, basepermissions
elseif ($web.hasuniqueroleassignments -ne "True")
Write-Output "****************************************"
Write-Output "Displaying site permissions for: $web"
"$web inherits permissions from $site"
Write-Host "Finished."
$site.dispose()
$web.dispose()
Hope it helps others !
Thanks and Regards,
Dipti
Dipti Chhatrapati -
Question about the CSS behavior when using layer 3 sticky and sticky table
Hi everyone,
I have a question about the CSS behavior when using layer 3 sticky and sticky table is full.
If I configure layer 3 sticky and specify the inactivity timeout as below, how does the CSS
handle subsequent needed sticky requests ?
advanced-balance sticky-srcip
sticky-inact-timeout 30
CSS document says that
Note:
If you use the sticky-inact-timeout command to specify the inactivity timeout
period on a sticky connection, when the sticky table becomes full and none of
the entries have expired from the sticky table, the CSS rejects subsequent
needed sticky requests.
My question is what is the next reaction by doing the CSS if the CSS is in the
following condition:
when the sticky table becomes full and none of the entries have expired from
the sticky table, the CSS rejects subsequent needed sticky requests
Does CSS just rejects/drops subsequent needed sticky requests ?
or
Does CSS does not stick subsequence requests to particular service but CSS forward
subsequence requests with round-robin basis ? which means if the sticky table is full,
the CSS just works round-robin load balancing fashion for subsequence requests ?
Your information would be appreciated.
Best regards,Hello,
There is a good document explaining this on Cisco web site
http://www.cisco.com/en/US/products/hw/contnetw/ps789/products_tech_note09186a0080094b4b.shtml
It depends if the sticky-inact-timeout is used or not. If not, it's FIFO (the oldest entry in the sticky table is removed). If yes, the CSS will reject the next sticky request.
Rgds,
Gaetan
Rgds
Gaetan -
Get the web part properties of documeny lib view web part using power shell
Hi,
Am looking to get the propeties of a list view web part - a document library's list view web part- using PowerShell
Manually I am able to do the same: the steps followed by me is given below:
1) I went to the
http://srvr1:123/sites/enggtest/mydoclib1/forms/allitems.aspx
2) Edit the page
3) Edit the mydoclib1 view web part
4) go to the peroperties
5) Check the Server Render checkbox
is there anyway i can do this using power shell.The code below assumes that the webpart is at index 0:
$SiteUrl = "http://aissp2013/sites/TestSite/"
$pageURL = "http://aissp2013/sites/TestSite/Lists/MyList/AllItems.aspx"
$web = Get-SPWeb $SiteUrl
$wpm = $web.GetLimitedWebPartManager($pageURL, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
$wp = $wpm.WebParts[0]
$wp.ServerRender = $true
$wpm.SaveChanges($wp)
Blog | SharePoint Learnings CodePlex Tools |
Export Version History To Excel |
Autocomplete Lookup Field -
i don't know how to use the canlendars function and the notes are kind of messy code,anyone help me
Step by step:
1. On your main vi Front Panel, create your boolean indicator.
2. On the block diagram, right click the new boolean indicator and select Create - Reference.
3. On sub-vi front panel, create boolean indicator (or use one that is already created).
4. On sub-vi front panel, create a reference (Controls Palette - Refnum - Control Refnum).
5. Right click on the newly created Refnum and select Select Vi Server Class - Generic - GObject - Control - Boolean. The refnum label changes to BoolRefnum.
6. On sub-vi block diagram, create Property Node (Functions - Application Control - Property Node). Find the BoolRefnum and move it close to the new Property Node.
7. Wire the BoolRefnum to the reference input of the property node.
8.
Right click on the property node and select Change to All Write.
9. Move mouse to point to Visible inside property node box, left click and select Value.
10. Wire the boolean indicator from step 3 to the Value input of the property node.
11. On sub-vi front panel, right click on icon and select Show Connector.
12. Click on empty connector spot then click on the new BoolRefnum. Save your sub-vi.
13. On main vi block diagram, connect refernece created in step 2 to the new connector terminal of sub-vi.
14. Save and run.
Here are the modified vi's.
- tbob
Inventor of the WORM Global
Attachments:
Pass_a_Reference.vi 20 KB
GL_Flicker_mod.vi 83 KB -
I would like to leave my iMac on Snow Leapord to use Power PC software, and run Mountain Lion on my Macbook pro. I am getting an iPhone 5. Is there a way to use mail on all of them with the same accounts?
Any IMAP e-mail account can be accessed from all devices just fine. You don't need to upgrade from Snow Leopard to be able to access an IMAP e-mail account. However, Snow Leopard won't have built-in support for iCloud. As mende1 points out, you can still read your iCloud e-mail from Snow Leopard, but you have to set it up manually. You won't be able to do things like sync your iCloud calendar or addresses with iCal or Address Book on the iMac, though.
Maybe you are looking for
-
Need to unplug and re-plug airport express every time I want to use it
Hi there, just bought an Aiport Express (new generation), the sole purpose being to stream i-tunes music from a Macbook Air and Ipad to my old analog stereo without having to hook it up with cables. The airport is "joined" to an existing wifi network
-
Help needed regarding change of system CLASSPATH
Hi All, I need to change the system CLASSPATH using my java programe. I tried the following code but its not working though it returns the correct CLASSPATH, but unable to do the modification. All I need is to append a new jar file in the existing CL
-
Can't get photoshop elements to open
I have used photoshop many times on this computer and have never had a problem until now. I tried to open it on my computer and I double clicked on the icon as well as went to "start" "programs" to get it to open and it won't do anything. When I ra
-
SUDDEN SURGE IN BROADBAND USEAGE ACCORDING TO BT
My average usage is approx 9GB per month but all of a sudden BT reckonS I have used 20GB and 1GB in the last 2 days. The problem is I am doing nothing different this month, have not downloaded anything etc. Does anybody know what may cause this? Also
-
Free item Indicator in PR (ME51N)
Free Item check box not appearing in PR- item overiview (ME51N). How can I get that in PR item overview screen????