Forced using the PSSessionOption -NoMachineProfile BUT SPFarm.Local is null - sharepoint

I am currently writing a Powershell module to provide functions for installing / operating SharePoint 2007.
One of my scripts checks the health of SharePoint servers farm.
So I use Remote Powershell : using New-PSSession.
In my Virtualized test farm (Windows server 2003, same domain, same admin...), the New-PSSession cmdlet failed :
After googling it, the only solution I saw was to use the NoMachineProfile option :
That solved my problem.
Now the problem :
I need to use SharePoint object : SPFarm.Local (on all servers)
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[Microsoft.SharePoint.Administration.SPFarm]::Local
This code works locally (on all servers)
But when I run it remotely (using the NoMachineProfile option), SPFarm.Local is null !
I Suppose (I cannot check it) it is because SharePoint uses some registry values that are not loaded because of the NoMachineProfile option.
So :
1 - Do you think SPFarm.Local is null because of the NoMachineProfile option ?
2 - Do you know how can I solve the first problem without using the -NoMachineProfile option ?
Thx a lot !

I believe your problem is related to the PowerShell Multi-Hop (Diagram below of what a multi-hop operation is) issue Which was discussed here... PowerShell is not able to perform a multi-hop operation by default, because your credential are not being passed to the next server... Since you are trying to contact different SP servers in the farm from a remote host. I would recommend reading the following blog entry related to multi-hop scenarios and following his instructions to correct your issue.
Using CredSSP for multi-hop authentication
http://www.ravichaganti.com/blog/?p=1230
I know this diagram mentions file server but it’s the same basic principle.

Related

WMI Query to detect the Microsoft office architecture installed in a Windows 7 machine

I am working in SCCM,while installing SAP Bussiness object Analysis ,MS Office is one of the prerequest.I need to add a condition in Task sequence to check the version of MS office architecture before installing SAP.
I got registery path to check that "HKLM\SOFTWARE\Microsoft\Office\15.0\Outlook"
BITNESS =x64 or x86. if the machine don't have outlook this wont work.
So i need a WMI query to check the bitness or a any other registry path to check the bitness of office . please help
I wouldn't bother with a WMI query, just create a task sequence for deploying SAP and use conditions to determine if Office is installed or not. It'll be much easier in the short term.
I would do this outside of the task sequence. How I will do is:
Method 1:
- Create device collection based on the condition (I would prefer using hardware inventory data to filter)
- deploy the SAP Application/package to the 'correct' collection
Method 2:
For application type of deployment, there are 'Requirement' settings on the deployment type. What you need to do is to create a registry based Global Condition (almost clicks-and-types-and-clicks) and attach this to the SAP application deployment type.
If you are not familiar with Global Condition, below is an official document link URL which will get you started:
https://technet.microsoft.com/en-us/library/gg682048.aspx

Can't Uninstall Sharepoint Application - Invalid State

Our Sharepoint 2013 Application failed to install and is stuck in a odd state. I followed the recommended approach for deleting the application using powershell commands on the hosted Sharepoint server, but it doesn't execute properly.
Visual Studio Deployment/Retract Reports:
Skipping the uninstall step because the app for SharePoint is in an invalid state and cannot be uninstalled.
PowerShell Commands
$instances = Get-SPAppInstance -Web http://mysite/sites/collection
$instance = $instances | where {$_.Title -eq 'Application.Title'}
Uninstall-SPAppInstance -Identity $instance
Executing this PS command throws...
The System Account cannot perform this action.
There is no option from the Sharepoint UI to remove the application, and retrying the install also fails. I've tried other user accounts to execute this powershell command (other than the system account), but no dice. I will have to delete the developer site collection if there is no other solution.
I'm faced this problem before on my Office 365 SharePoint Online when deploy SharePoint Hosted App. Then I submit Microsoft Service request and work with MS Technical Support Team on this issue. This problem seem to be something error in SharePoint backend database by itself (I'm not sure to consider it is SharePoint defect).
Did you check the app details installation error report? If you get the message:
"The content database on the server is temporarily unavailable."
Need help: Error 'Install App for SharePoint': An instance of this App already exists at the specified location., I'm quite not understand the answer but there is one comment from Jeremy Thake which seem to be deleted on this thread, he said that:
"…so I actually just restarted the whole environment and when Windows
came back up and I went to the SharePoint Site…the App was gone ;-)"
So here is my advice before you commit to delete your site collection:
Try to deploy your to the another developer site collection and check whether this problem still occur as the same.
Try to increase your app version or change app name/title/id and deploy to the same site collection and check whether this problem still occur as the same to your new app instance.
For SharePoint Server, try to restart IIS/Window Server if you're able to do that. Also install any latest SharePoint Update/CU.
For Office365 - SharePoint and have you have license account, you should submit the service request, if not you should wait about several day and try to remove this app instance again through UI.
Hope you can remove your app and know the root cause exactly.
I have faced this issue some times in on-premises SharePoint.
But for solving this I gave another account (or you can use 1 that you have) shell admin rights.
Note this account CAN'T be marked as a System account on SharePoint!!
Then with this different shell admin account you execute the same script. That always worked for me (I also got some strange installation behavior and needed do remove the app).

Resolving Mass-loading problems in WebSphere Commerce Instance creation

I am trying to create an instance using the Configuration Manager of WCS 7. I am working on a Win 7 x64 machine with DB2 9.5 64 bit version.
I am struck with this Massloading error when the instance creation happens :
In createInstanceANT.log file :
[Massload] Massloading
C:\IBM\WebSphere\CommerceServer\schema\xml\wcs.keys.xml Error in
MassLoading, please check logs for details.
The error log shows the following error :
[jcc][10165][10044][4.3.111] Invalid database URL syntax:
jdbc:db2://:0/WCSDEMO. ERRORCODE=-4461, SQLSTATE=42815
C:\IBM\WEBSPH~1\COMMER~2\config\DEPLOY~1\xml\createBaseSchema.xml:185:
Error in massloading
WCSDEMO is the database name. The Massloader is not able to get the URL and port to connect. It is supposedly getting them from createInstance.properties file but it is not working. The createInstance.properties file has all the details of the DB to connect.
What could be the reason for this error and how to resolve it ? Is there any configuration change that I am missing ?
Can you provide some more details.
look inside the messages.txt file located in WC_install_dir/instances/instance_name/logs
and confirm what the exact issue is. If it is related to jdbc driver being wrong I may be able to help you.
I've been running into massloading problems with external systems. Eg. databases not on the same machine as the WAS installation.
In these cases I look for the
As you can see setting the loaderDBName to just the name of the database would look on the local machine. But by changing this statement so you load with the syntax
loaderDBName=[DATABASE_SERVER_NAME]:[PORT]/[DATABASE_NAME]
You'll be able to massload using the commerce standard scripts. These changes needs to be done in many scripts. Both for updating fixpacks and enabling features. If you run database updates without the changes it will crash at first and have done all the schema changes to the database that you then need to comment out before trying again.
IBM Software Support is your friend. They'll help you fix it.

Querying Service Status with ADSI - what rights are needed?

I'm using VB6 and using ADSI to query for the status (running or not) of a Windows Service. See this MS article: http://msdn.microsoft.com/en-us/library/aa746322(v=vs.85).aspx.
With a user who is a member of the USERS group, I'm receiving a thrown exception. I believe it's on the GetObject method:
Set comp = GetObject("WinNT://.,Computer")
The exception is: 80070005 "General access denied error"
Running the same code as a member of POWER USERS, however, works just fine.
Elevating all users to Power users isn't an option. What exact rights do I need to have granted in order for this function to run successfully?
I've tried running procmon.exe, and wasn't able to determine from the output as to what or where a denial is occurring.
Thanks!
Edit: This is running on XP sp2.
Sounds like you're running into a UAC barrier. I'm not familiar with IADsService, but it is hardly necessary in determining if a Windows service is running. Have you considered using API functions to query your service? Try QueryServiceStatus on a service opened with SERVICE_QUERY_STATUS.
There is no need for heavyweight administrative services or API calls. The Shell Automation interface has offered this for some time (Win2K or later, Shell32.dll v. 5.0 or later):
With CreateObject("Shell.Application")
MsgBox .IsServiceRunning("MSMQ")
End With
Works fine for me without elevation.

Give webservice access to windows service

I am running a webservice on server 2008 that needs access to a windows service and I need to give access to [the user that the web service is running as] via the command line.
(sorry if my wording is terrible, hopefully the brackets helped?).
I know there is a utility available with the windows 2000 resource kit (SUBINACL.exe), but is there one available in server 08 that doesn't require downloading a resource kit?
Thanks.
For everyone else wondering how to do this...
Microsoft offers a utility available for download called Subinacl.exe that allows you to do just this.
subinacl.exe /service <serviceName> /grant=Domain\AccountName=<AccessType>
For info on the different access types and on the utility in general...
subinacl.exe /help /full

Resources