powershell 记录
the following module was built either with optimizations enabled or without debug information
solution:
I have also faced the same problem on migrating the application .net 1.x to 2.0 and i solved by disabling the "Warn if no user code on launch" under the debugging option in the tools menu.
Tools -- Options -- Debugging -- General -- Enable Just my code (Managed only) -- un check "Warn if no user code on launch"
Release build模式无法调试,会直接run 过
Powershell使用dll
password="password"password="password"securePassword = ConvertTo-SecureString password−AsPlainText−Forcepassword−AsPlainText−Forcedomain="domain"
userName="user"userName="user"credential = new-object Management.Automation.PSCredential((domain+"\"+domain+"\"+userName),securePassword)securePassword)computerName = "sptws-sut02"
mainUrl="http://"+mainUrl="http://"+computerName
siteName="test"siteName="test"path="C:\Users\pettest\Desktop"
webName="HAHAHA"webName="HAHAHA"attachmentName="testAttachmentName2"
attachmentName=attachmentName=attachmentName + ".txt"
ret=invoke−command−computerret=invoke−command−computercomputerName -Credential credential -scriptblock{ param( [string]credential -scriptblock{ param( [string]siteName,
[string]webName,[string]webName,[string]path,
[string]attachmentName,[string]attachmentName,[string]mainUrl
)
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | out-null
spSites=new−objectMicrosoft.SharePoint.SPSite(spSites=new−objectMicrosoft.SharePoint.SPSite(mainUrl)
spWeb=spWeb=spSites.openweb(siteName+"/"+siteName+"/"+webName)
attachmentUrl=attachmentUrl=path + "\" + attachmentNameattachmentNamefStream = [System.IO.File]::OpenRead(attachmentUrl)attachmentUrl)byteArray = new-object byte[] fStream.LengthfStream.LengthfStream.Read(byteArray,0,[int]byteArray,0,[int]fStream.Length);
fStream.close()fStream.close()spWeb.Folders["Shared Documents"].Files.Add(attachmentName,attachmentName,byteArray)
}-argumentlist siteName,siteName,webName, path,path,attachmentName,mainUrlPowershell使用sharepoint自带的powershellmainUrlPowershell使用sharepoint自带的powershellret = invoke-command -computer computerName−CredentialcomputerName−Credentialcredential -scriptblock{
param(
)
ver=ver=host | select version
if (ver.Version.Major−gt1)$Host.Runspace.ThreadOptions="ReuseThread"Add−PsSnapinMicrosoft.SharePoint.PowerShellSet−locationver.Version.Major−gt1)$Host.Runspace.ThreadOptions="ReuseThread"Add−PsSnapinMicrosoft.SharePoint.PowerShellSet−locationhome
application=Get−SPServiceApplication−name"BusinessDataConnectivity"application=Get−SPServiceApplication−name"BusinessDataConnectivity"guid=application.IDwrite−hostapplication.IDwrite−hostguid
return guidPublish−SPServiceApplicationguidPublish−SPServiceApplicationguid
}
Sharepoint的Powershell
罗列一些命令:
Get-SPDatabase
Database:Microsoft.Office.Server.Administration.ProfileDatabase
DataConnectionFile:Microsoft.Office.InfoPath.Server.Administration.DataConnectionFile
Get-SPIisWebServiceApplicationPool
Get-SPServiceApplication
Stop-SPServiceInstance –Identity id–comfirm:id–comfirm:false
远程调用Powershell前,client和server要执行:
Enable-PSRemoting
Set-executionPolicy unrestricted/remotesigned
如果client端是x64,则务必在powerehll-x86和-x64上都要执行
相关文章
- Mongodb集群搭建及spring和java连接配置记录
- 初学做uniapp项目过程梳理的一些记录
- 记录搭建ssm项目
- 关于设置MX记录
- 分享价值,记录点滴!
- 查询记录时rs.previous()的使用
- ThinkPHP 上传漏洞记录
- 12.5日学习记录
- powershell渗透工具——Powershell内网渗透利器之PowerSploit,场景真tm多啊
- 刷题记录:牛客NC24019Max Flow
- 【刷题记录⑧】Java工程师丨字节面试真题(二)
- 刷题记录:牛客NC16539&&牛客NC21181(表达式求值的一些事)
- Knife4j学习采坑记录
- Git 清空本地所有提交修改记录
- 【问题记录】pip install -r requirements.txt 安装失败