Friday, June 7, 2013

External user invitations in SharePoint 2013 Cloud version

Where is the feature "External user invitations" in SharePoint 2013 Cloud?

Few days back Microsoft enabled SharePoint 2013 on our cloud. Finally I am on 2013 version whew.. everything looks good :)

Damn was not able to find the feature under Site Collection feature. Not much help from my best buddy Google, after lengthy research figured out an Option "Sharing" under SharePoint-Admin site collection (the one where we create Private Site Collection) ahhhh that was easy. This Sharing option is enabled only when you select SharePoint 2013 site



Hope this saves time for someone getting below message

Sorry, you are not allowed to share this with external users


CHeeeeRS :) !
Amitabh

Tuesday, May 14, 2013



jQuery…
Always wanna write about some common stuff in jQuery. There are many ways to achieve this functionality and the one I am going to write today is one of themJ. Any scope for improvement is always welcome

We always get around this requirement of providing extra info on Mouse hover of an image or on click. We had an requirement to show description over mouse hover. I quickly created an approach using jQuery (rather than css à don’t wanna face browser incompatibility )

Here is the code---> which is very straight forward and could be understood very easily.. ahhh an explanation for being lazy today :) 



<img id='img_Forhover' src=’ /myImageForDemo.png'/>
<style type="text/css">
                .div-img-overlay {
                                z-index:1000;
                                background-color:#000;
                                color:#fff;
                                padding: 1px 10px 1px 10px;
                }
</style>
<div class="div-img-overlay">
<h4>This is my title</h4>
<p>A description of the image. A description of the image on the second line.</p>
</div>
<script type='text/javascript'>
$(document).ready(function() {
                var mytop = -99;
                $('.div-img-overlay').hide();
                $('#img_Forhover').hover(function() {
                                if(mytop == -99) {
                                                var imgDiv = $('.div-img-overlay');
                                                var imgElem = $('#img_Forhover');
                                                var offset = imgElem.offset();
                                                imgDiv.width(imgElem.width()-20);
                                                mytop = offset.top + imgElem.height() - imgDiv.height()-2;
                                                $('.div-img-overlay').css({position:"absolute"});
                                                $('.div-img-overlay').offset({top: mytop, left: offset.left});
                                }
                                $('.div-img-overlay').show();
                                $('.div-img-overlay').fadeTo(20, 0.75);
                                }, function(){
                                                $('.div-img-overlay').hide();
                                });
                });
</script>

Monday, April 8, 2013

Restart Virtual Machine remotely using power shell


Lots of loads on the poor virtual machine makes them unresponsive quite a few times and we face this issue of restarting a VM remotely.... good to write a blog about it and save time of some one :)

Lets make it more challenging by using Power Shell

Make sure that you'd already turn on the Power Shell Remoting feature on using cmdlet Enable-PSRemoting

To run the power shell commands from remote machine, first connect to that machine using power shell console cmdlet Enter-PSSession which requires a parameter credential, so its always better to store the credential in a variable

Store credential in a var
PS C:\Users\MyUserAdminAccount> $cred = Get-Credential -Credential MyUserAccountDomain\MyUserAdminAccount

Now connect to that machine, but wait if you receive below error then you havent executed Enable-PSRemoting on that server
PS C:\Users\MyUserAdminAccount> Enter-PSSession -ComputerName MyDestinationServerName -Credential $cred
Enter-PSSession : Connecting to remote server failed with the following error message : The client cannot connect to th
e destination specified in the request. Verify that the service on the destination is running and is accepting requests
. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or Win
RM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the
WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:16
+ Enter-PSSession <<<<  -ComputerName MyDestinationServerName -Credential $cred
    + CategoryInfo          : InvalidArgument: (MyDestinationServerName:String) [Enter-PSSession], PSRemotingTransportExceptio
   n
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed



This time clean attempt to connect to MyDestinationServerName--
PS C:\Users\MyUserAdminAccount> Enter-PSSession -ComputerName MyDestinationServerName -Credential $cred

Now to find how many users are already connected to this VM, use standar query command
[MyDestinationServerName]: PS C:\Users\MyUserAdminAccount\Documents> query session /SERVER:MyDestinationServerName
 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
 services                                    0  Disc
 console                                     1  Conn
 rdp-tcp#1         MyUserAdminAccount        45  Active  rdpwd
 rdp-tcp                                 65536  Listen

Now use the logoff command to logoff a particular session, wanna know what is it?
[MyDestinationServerName]: PS C:\Users\MyUserAdminAccount\Documents> cmd /c logoff/?
cmd.exe : Terminates a session.
    + CategoryInfo          : NotSpecified: (Terminates a session.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V] [/VM]
  sessionname         The name of the session.
  sessionid           The ID of the session.
  /SERVER:servername  Specifies the Remote Desktop server containing the user
                      session to log off (default is current).
  /V                  Displays information about the actions performed.
  /VM                 Logs off a session on server or within virtual machine. The unique ID of the session needs to be
specified.


[MyDestinationServerName]: PS C:\Users\MyUserAdminAccount\Documents> logoff 45 /Server:MyDestinationServerName /v /vm
You are about to logoff MyUserAdminAccount (session 45) from machine ,
continue (n=no)?

Finally restart the virtual machine
[MyDestinationServerName]: PS C:\Users\MyUserAdminAccount\Documents> restart-computer MyDestinationServerName

So easy isn't it?