pushd "%~dp0"dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hv.txtfor /f %%i in ('findstr /i . hv.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"del hv.txtDism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALLpause
$web = Get-SPWeb -Identity https://sharepoint/sites/PowerShellTests $folder = $web.Folders["Workflows"] $property = $folder.Properties["docid_msft_hier_listid_validate"] $dt = Get-Date -Year 2100 -Month 12 -Day 31 $folder.Properties["docid_msft_hier_listid_validate"] = $dt $folder.Update() $web.Update()
$url = "https://sharepoint/sites/PowerShellTests" $web = Get-SPWeb $url $lib = $web.GetList($web.Url + "/oldName") $rootFolder = $lib.RootFolder $rootFolder.MoveTo($web.Url + "/newName")
$wa = $get-spwebapplication "my site host url"$wa.Sites | foreach-object { if ( $_.Url.StartsWith("my site host url/personal") ) { Set-SPSite -Identity $_.Url -QuotaTemplate "Personal Site" }}
function SendSmtpMail($server, $sender, $recipients, $subject, $body, $file){ $msg = new-object Net.Mail.MailMessage $smtpServer = new-object Net.Mail.SmtpClient($server) $msg.From = $sender $msg.Subject = $subject $msg.Body = $body foreach ($recipient in $recipients) { $msg.To.Add($recipient) } if ($file -ne "") { $att = new-object Net.Mail.Attachment($file) $msg.Attachments.Add($att) } $smtpServer.Send($msg) if ($file -ne "") { $att.Dispose() }}$smtpServer = "my smtp server"$file = "path to file"$recipients = @( "user1@test.de", "user2@test.de" )$sender = "sender@mydomain.com"$subject = "My Subject"$body = "My Mail Text"SendSmtpMail $smtpServer $sender $recipients $subject $body $file
$locked = $true while ($locked) { try { $file = New-Object System.IO.FileInfo $Path [IO.File]::OpenWrite($file).close(); $locked = $false } catch { # file is locked by a process. Start-Sleep -s 1000 } }
$analytics = Get-SPUsageDefinition | where { $_.Name -like "Analytics*" } $pageRequests = Get-SPUsageDefinition | where { $_.Name -like "Page Requests" }
$analytics.Receivers.Count $pageRequests.Receivers.Count
if ($analytics.Receivers.Count -eq 0) { $analytics.Receivers.Add( "Microsoft.Office.Server.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.Server.Search.Analytics.Internal. AnalyticsCustomRequestUsageReceiver") } if ($analytics.EnableReceivers -eq $false) { $analytics.EnableReceivers = $true $analytics.Update() } if ($pageRequests.Receivers.Count -eq 0) { $pageRequests.Receivers.Add( "Microsoft.Office.Server.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.Server.Search.Analytics.Internal. ViewRequestUsageReceiver") } if ($pageRequests.EnableReceivers -eq $false) { $pageRequests.EnableReceivers = $true $pageRequests.Update() }
<Batch OnError="Continue" PreCalc="TRUE" ListVersion="0"> <Method ID="1" Cmd="Update"> <Field Name="ID">SubItemID</Field> <Field Name="ParentID">ItemID</Field> </Method> </Batch>
$farm = Get-SPFarm $file = $farm.Solutions.Item("MySolution.wsp").SolutionFile $file.SaveAs("c:\temp\MySolution.wsp")
# Configuration $app = Get-SPWebapplication "web app url" $jobname = "my job name" $siteurl = "site url will be used within the job" # Install $job = New-Object MyNamespace.MyClass( $jobname, $app, $siteurl) $job.Schedule = [Microsoft.SharePoint.SPSchedule]:: FromString("daily between 01:00:00 and 01:00:00") $job.Update() Restart-Service SPTimerV4 # Check (Get-SPTimerJob | where-object{$_.Name -eq $jobname)}) | fl
# enter valid values $url = "https://sharepoint.c2go.net/sites/test" $listName = "MyListName" $login = "MyLogin" $web = Get-SPWeb $url $userid = ($web.Allusers | where-object { $_.LoginName -eq $login }).ID $user = $web.AllUsers.GetByID($userid) $token = $user.UserToken; $impSite = New-Object Microsoft.SharePoint.SPSite ($web.Url, $token); $impWeb = $impSite.OpenWeb() $impList = $impWeb.Lists[$listName] $impList.Views
string url = "https://sharepoint/sites/teamsite";string domain = "myDomain";string login = "myLogin";string pwd = "myPassword"; // feature id for MySite Newsfeed webpart:Guid feature = new Guid("6928B0E5-5707-46a1-AE16-D6E52522D52B");using (var ctx = new ClientContext(url)){ ctx.AuthenticationMode = ClientAuthenticationMode.Default; ctx.Credentials = new System.Net.NetworkCredential(login, pwd, domain); var features = ctx.Site.Features; ctx.Load(features); ctx.ExecuteQuery(); features.Add(feature, true, FeatureDefinitionScope.None); ctx.ExecuteQuery();}
$destinationUrl = "https://sharepoint/sites/teamsite/documents"$file = get-childitem "e:\tmp\document.txt"$webclient = New-Object System.Net.WebClient $webclient.UseDefaultCredentials = $true$webclient.UploadFile($destinationUrl + "/" + $file.Name, "PUT", $file.FullName)
add-pssnapin microsoft.sharepoint.powershell $spserver = get-spserver | ?{$_.role -eq "Application"} foreach ($server in $spserver) { $name = [string]::concat("\\", $server.name) write-host "Performing IIS Reset on Server:"$server.name iisreset $server.Name write-host "Stopping SPTimerV4 on Server:"$server.name $stat = sc.exe $name stop sptimerv4 $stat = sc.exe $name query sptimerv4 while ($stat -match "STOP_PENDING") { write-host "Stopping" $stat = sc.exe $name query sptimerv4 start-sleep 4 } write-host "Starting SPTimerV4 on Server:"$server.name $stat = sc.exe $name start sptimerv4 $stat = sc.exe $name query sptimerv4 while (-not $stat -match "RUNNING") { write-host "Starting" $stat = sc.exe $name query sptimerv4 start-sleep 4 } write-host "SPTimerV4 started on Server:"$server.name}
# if I have to talk to a different but truested domain$dc = "my_domain_controller"# my groups$group1 = "my_first_group"$group2 = "my_second_group"diff (Get-ADGroupMember -Identity $group1 -Server $dc) (Get-ADGroupMember -Identity $group2 -Server $dc) -Property 'distinguishedName' -IncludeEqual | ?{ $_.sideIndicator -eq "==" } | foreach-object { write-host $_.distinguishedName ; Remove-ADGroupMember -Identity $group1 -Server $dc -Members $_.distinguishedName -Confirm:$false }
(function () { var overrideCtx = {}; overrideCtx.Templates = {}; overrideCtx.OnPostRender = [ HighlightRowOverride ]; overrideCtx.Templates.Fields={ "Colour":{"View":RenderColour}} SPClientTemplates.TemplateManager.RegisterTemplateOverrides (overrideCtx);})();function RenderColour(ctx) { var link = ctx.displayFormUrl + "&ID=" + ctx.CurrentItem.ID + "&source=" + encodeURIComponent(window.location.href); var text = "< a class='ms-core-suiteLink-a' href='" + link + "'>< img src='/_layouts/15/images/icgen.gif'>"; return text;}function HighlightRowOverride(inCtx) { for (var i = 0; i < inCtx.ListData.Row.length; ++i) { var listItem = inCtx.ListData.Row[i]; var iid = GenerateIIDForListItem(inCtx, listItem); var row = document.getElementById(iid); if (row != null) { row.style.backgroundColor = listItem.Colour; } } inCtx.skipNextAnimation = true;}
$followedSite = „https://sharepoint/sites/news“$loginName = „roloff“$profile = $upm.GetUserProfile($loginName)$manager = New-Object Microsoft.Office.Server.Social.SPSocialFollowingManager($profile)$actorInfo = New-Object Microsoft.Office.Server.Social.SPSocialActorInfo$actorInfo.ContentUri = $followedSite$actorInfo.ActorType = 2 # SPSocialActorType.Site$manager.Follow($actorInfo)
$adGroup = "" # AD Group with MySite users$siteURL = "" # any local SharePoint Site will do$members = Get-ADGroupMember -Identity $adgroup -Recursive | sort name# get UserProfileManager$serviceContext = Get-SPServiceContext -site $siteURL -ErrorAction Stop$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext) -ErrorAction Stopforeach ($member in $members){if ($upm.UserExists($member.SamAccountName)){ $profile = $upm.GetUserProfile($member.SamAccountName) $perssite = $profile.PersonalSite if ($perssite -eq $null) { # either this $profile.CreatePersonalSite(1031) # should work in most cases # or this # $profile.CreatePersonalSiteEnque($true) # will work in all cases; gets language from mysite host $perssite = $profile.PersonalSite if ($perssite -eq $null) { # do some error handling } }}}
Get-SPDatabase | where-object { $_.TypeName -eq "Content Database" } | select Displayname, @{Name="Mbytes";Expression={$_.DiskSizeRequired/ 1Mb}}
=";#choice 1;#choice 2;#choice 3;#"
# URL to your MySite web application$MySiteWebUrl = "https://mysite.collaboration-2-go.net" # where to find users in the AD$searchbase="DC=collaboration-2-go,DC=net" # required if server domain and user domain are different$dc="my_domain_controller" # required if server language is English and# MySite language is different$culture = "de-DE"$webapp = Get-SPWebApplication -identity $MySiteWebUrl[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture foreach ($site in $webapp.Sites){ # Get Active Directory Information $login = $site.Owner.LoginName if ($login.contains("\")) { $login = $login.substring($login.indexof("\") + 1) } $ldapfilter = "(SamAccountName=" + $login + ")" $aduser = Get-ADUser -LDAPFilter $ldapfilter -SearchBase $searchbase -Server $dc $displayName = $aduser.GivenName + " " + $aduser.Surname if ($displayName -eq " ") { $displayName = $site.owner.DisplayName } if ($site.RootWeb.WebTemplate -eq "SPSPERS") # ignore MySite host { # more sophisticated approach is possible but # I'm not sure about the blog URL foreach ($web in $site.AllWebs) { if (($web.WebTemplate -eq "BLOG") -and ($web.Title -eq "Blog")) { $title = "Blog von " + $displayName $web.Title = $title $web.Update() } $web.Dispose() } } $site.Dispose()}
$web = Get-SPWeb https://sharepoint/sites/blogwrite-host $web.Properties["ms-blogs-skinid"]$web.Properties["ms-blogs-skinid"] = 1$web.Properties.update()
Merge-SPLogFile -Path C:\tmp\FarmLog.log
Merge-SPLogFile -Path C:\tmp\FarmLog.log -Correlation b572479c-ce57-10ce-c901-ce456a0284dc
Merge-SPLogFile -Path C:\tmp\FarmLog.log -StartTime "28.07.2013 00:00" -EndTime "28.07.2013 23:59"
http://yourhost/_layouts/closeConnection.aspx?loginasanotheruser=true
' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' URL ListDim urls(3)urls(1)="https://portal/sites/project1"urls(2)="https://portal/sites/project2"urls(3)="https://portal/sites/project3"Dim servers(2)servers(1) = "server1"servers(2) = "server2"Dim PingReplyPingReply = "Reply from"Dim TargetUrlTargetUrl = "portal"Dim outFileoutFile="c:\WarmUp\WarmUp2013.log"' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''On error resume next' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Codedim fsodim startTimestartTime = Now'DeleteLogAddToLog "------------------------------------------------"set fso = CreateObject("Scripting.FileSystemObject")For Each server in servers If server <> "" Then AddToLog "---------------- " & UCase(server) hostfile = "C:\Windows\System32\drivers\etc\hosts-" & server fso.CopyFile hostfile, "C:\Windows\System32\drivers\etc\hosts" PingResult TargetUrl WarmUp() End IfNextAddToLog "---------------- RESET"fso.CopyFile "C:\Windows\System32\drivers\etc\hosts-original", "C:\Windows\System32\drivers\etc\hosts"PingResult TargetUrlset fso = NothingAddToLog "---------------- Summary"minTime = UBound(urls) * UBound(servers) * 5duration = datediff("s", startTime, now)AddToLog "URLs: " & UBound(urls)AddToLog "Minimal Time: " & minTimeAddToLog "Duration (s): " & durationIf duration > (minTime + 5) Then AddToLog "Warning!"End IfAddToLog "------------------------------------------------"' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Subssub WarmUp() dim ie set ie = CreateObject("InternetExplorer.Application") ie.Visible = 0 For Each u1 In urls if u1 <> "" then AddToLog u1 ie.Navigate2 u1 WScript.Sleep(5000) Do while IE.readystate <> 4 loop end if Next ie.Quit set ie = Nothingend subsub DeleteLog() outFile="c:\svn\WarmUp2013.log" Set objFSOFile=CreateObject("Scripting.FileSystemObject") objFSOFile.DeleteFile outFileend subsub AddToLog(txt) set objFSOFile=CreateObject("Scripting.FileSystemObject") set objFile = objFSOFile.OpenTextFile(outFile, 8, True) objFile.Write Now & " - " & txt & vbCrLf objFile.Close wscript.echo txtend subsub PingResult(host) dim objShell dim objExec set objShell = CreateObject("WScript.Shell") set objExec = objShell.Exec("ping -n 1 -w 1000 " & host) pr = objExec.StdOut.ReadAll pr = mid(pr, InStr(pr, PingReply)) pr = left(pr, InStr(pr, ":") - 1) AddToLog pr set objShell = Nothing set objExec = Nothingend sub
c:\Windows\System32\inetsrv\appcmd.exe list wp
open *smtp-server* 25 HELO MAIL FROM: *sender smtp address* RCPT TO: *recipient smtp address* SUBJECT: *subject* DATA *your mail text* *empty line*
CREATE TABLE [dbo].[Orders]( [ID] [int] IDENTITY(1,1) NOT NULL, [OrderDate] [date] NOT NULL, [CustomID] [int] NOT NULL, [Title] [nchar](50) NOT NULL ) ON [PRIMARY]
BEGIN TRAN declare @currentMaxID int declare @newID int select @currentMaxID = max(CustomID) from [dbo].[Orders] WITH (UPDLOCK) where year(OrderDate) = year(getdate()) and month(OrderDate) = month(getdate()) if @currentMaxID is null begin set @currentMaxID = 0 end set @newID = @currentMaxID + 1 insert [dbo].[Orders] (OrderDate, CustomID, Title) values (getdate(), @newID, 'my title') COMMIT
try { // Create new Session Outlook.Application outApp = new Microsoft.Office.Interop. Outlook.Application(); Outlook.NameSpace ns = outApp.GetNamespace("MAPI"); ns.Logon(Type.Missing, Type.Missing, false, true); // Change Context Outlook.Recipient organizer = ns.CreateRecipient( "shared@collaboration-2-go.de"); organizer.Resolve(); // Open Shared Calendar Outlook.MAPIFolder folder = ns.GetSharedDefaultFolder( organizer, Microsoft.Office.Interop.Outlook.OlDefaultFolders. olFolderCalendar); // Create Meeting Request in Shared Folder Outlook._AppointmentItem mr = (Outlook._AppointmentItem)folder.Items.Add( Microsoft.Office.Interop.Outlook. OlItemType.olAppointmentItem); mr.MeetingStatus = Microsoft.Office.Interop.Outlook. OlMeetingStatus.olMeeting; mr.Location = "my location"; Outlook.Recipient recipient = mr.Recipients.Add( "user@collaboration-2-go.de"); recipient.Resolve(); recipient.Type = (int)Outlook.OlMeetingRecipientType.olRequired; mr.Subject = "my subject"; mr.Start = DateTime.Now.AddHours(1); mr.Duration = 60; mr.Body = "my meeting request"; mr.ReminderMinutesBeforeStart = 15; mr.ReminderSet = true; mr.Save(); mr.Send(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); }
?Contents=1
http://collaboration/SitePages/Homepage.aspx?Contents=1
net start MSSQLSERVER net start SQLWriter net start IISADMIN net start W3SVC net start SPTraceV4 net start OSearch14 net start SPAdminV4 net start SPTimerV4
net stop SPTraceV4 net stop OSearch14 net stop SPAdminV4 net stop SPTimerV4 net stop MSSQLSERVER net stop SQLWriter net stop IISADMIN net stop W3SVC
<Where> <Eq> <FieldRef Name='Name' /> <Value Type='Lookup'>Smith</Value> </Eq> </Where>
<Where> <Eq> <FieldRef Name='Name' LookupId='True' /> <Value Type='Lookup'>7</Value> </Eq> </Where>
declare @dbname sysname declare @sql nvarchar(1000) declare db_cursor cursor for select name from master.dbo.sysdatabases where name not in ('tempdb', 'model', 'msdb', 'master') open db_cursor fetch next from db_cursor into @dbname while @@fetch_status = 0 begin print @dbname select @sql = ' ALTER DATABASE [' + @dbname + '] SET RECOVERY SIMPLE DBCC SHRINKDATABASE ([' + @dbname + ']) ALTER DATABASE [' + @dbname + '] SET RECOVERY FULL' exec sp_executesql @sql fetch next from db_cursor into @dbname end close db_cursor deallocate db_cursor
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <HideCustomAction Id="HideDeleteSPWeb" GroupId="SiteTasks" HideActionId="DeleteWeb" Location="Microsoft.SharePoint.SiteSettings"> </HideCustomAction> </Elements>
sqlcmd -Q "CREATE LOGIN [domain\user] from windows" sqlcmd -Q "EXEC sys.sp_addsrvrolemember @loginame = N'domain\user', @rolename = N'sysadmin'"
select * from sys.sysprocesses where dbid = DB_ID('WSS_Content')
declare @dbname sysname declare @basepath sysname declare @filename sysname declare @filedate varchar(8) set @basepath = 'c:\Backup\' select @filedate = convert(varchar(8), getdate(), 112) declare db_cursor cursor for select name from master.dbo.sysdatabases where name not in ('tempdb', 'model', 'msdb', 'master') open db_cursor fetch next from db_cursor into @dbname while @@fetch_status = 0 begin set @filename = @basepath + @filedate + '-' + @dbname + '.bak' print @filename backup database @dbname to disk = @filename with compression fetch next from db_cursor into @dbname end close db_cursor deallocate db_cursor
Field ID="{9D6556BF-D5AC-41B7-94BA-56ABE77CEDC8}"
Unable to locate the xml-definition for FieldName with FieldId '9D6556BF-D5AC-41B7-94BA-56ABE77CEDC8', exception: Microsoft.SharePoint.SPException ---> System.Runtime.InteropServices.COMException (0x8000FFFF): 0x8000ffff at Microsoft.SharePoint.Library.SPRequestInternalClass.GetGlobalContentTypeXml(String bstrUrl, Int32 type, UInt32 lcid, Object varIdBytes)…
caspol -m -ag 1.2 -url file:\\z:\MyPath FullTrust
<asp:DropDownList runat="server" ID="ddl" AccessKey="1"> <asp:ListItem Text="item1" /> <asp:ListItem Text="item2" /> </asp:DropDownList>
Line 135, Column 93: there is no attribute "accesskey" …ame="ctl00$MainContent$ddlTitle" id="ctl00_MainContent_ddl" accesskey="1">
$FolderPath = "/TEMP" $NewFolder = "CalendarTest" $PFRoot = "file://./backofficestorage/litwareinc.com/Public Folders" # Use PowerShell cmdlet to create new folder # (depending upon whether a root folder or not) if ($FolderPath -ne "") { $f = $FolderPath -replace("/", "\") New-PublicFolder -Name $NewFolder -Path $f } else { New-PublicFolder -Name $NewFolder } # Use ADO to change the folder type $o=New-Object -comobject ADODB.Record $updated=$false $timeout=60 while (($updated -eq $false) -and ($timeout -gt 0)) { $o.Open($PFRoot + $FolderPath + "/" + $NewFolder, "", 3, -1, -1, "", "") foreach($item in $o.Fields) { if($item.Name -eq "http://schemas.microsoft.com/exchange/outlookfolderclass") { $updated=$true $item.Value="IPF.Appointment" } } $o.Fields.Update() $o.Close() if ($updated -eq $false) { Start-Sleep -s 1 $timeout -- } }
<script type="text/javascript" src="http://mediaplayer.yahoo.com/js" > </script> <a href="mymusicfile.mp3" >My Music</a>
/* Hide player */ #ymp-player, #ymp-tray, #ymp-error-bubble, #ymp-secret-bubble { display: none !important; } /* Hide Buttons */ a.ymp-btn-page-play, a.ymp-btn-page-pause { margin-left: -20px !important; } a.ymp-btn-page-play em.ymp-skin, a.ymp-btn-page-pause em.ymp-skin { display: none !important; }