by willbs at 2013-03-08 09:17:14
how do i go about running windows storage server (wss*) commands on a remote server so it is transparent to me while developing/testing/running codeby DexterPOSH at 2013-03-08 22:01:30
is there some kind of snap-in available or something?
for example i have this code,
invoke-command -scriptblock {Get-wssuser} -computername $global:uutName -credential $global:Credential
when i run it i get,
The term ‘Get-wssuser’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (Get-wssuser:String) , CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : 192.168.0.102
Hi willbs,by willbs at 2013-03-09 09:02:03
The error says that it wasn’t able to find the cmdlet. Does the cmdlet Get-wssuser comes with a module or snapin or a script.
Then you need to load the snapin or module first before doing this.
Just an example below:Invoke-Command -computername $computername -ScriptBlock {Add-PSSnapin Quest*; Get-QADUser -Identity ddxx00} -credential $credential
In above example am using Get-QADUser cmdlet which comes with Quest AD snapins, so I need to add them to my current session before I start using them.
If the Get-WssUser is defined in a script then you first need to dot source the script in your session. Before using it.
Hope it helps
that there is some kind of snapin available was what i was hoping for, i’ve looked everywhere, and there is very little if any info on wss* commands or a way to hook into themby AlexBrassington at 2013-03-10 16:10:58
What is WSS? The reason I ask is that WSS is a name for the old SharePoint 2.0 and 3.0 (2003/2007) systems. If it’s SharePoint then I might be able to help (there’s also a couple of SharePoint MVPs floating about too, which is handy), although if you’re having issues with the remoting in particular my advice is don’t even try it. Possible in theory but not designed, supported or worth the pain.by willbs at 2013-03-11 08:23:37
sorry, wss is windows storage serverby DexterPOSH at 2013-03-12 01:25:11
Hi willbs,by willbs at 2013-03-13 08:53:03
You can enter a PS session usingEnter-PSSession -ComputerName <ServerName>and then on the remote computer check all the Snapins usingGet-PSSnapin -Registeredand modules usingGet-Module -Listavailableand look if there is something which could contain wss* cmdlets you want to use. If you are not able to guess by the name try loading them one by one usingAdd-PSSnapin <SnapinName>orImport-Module <ModuleName>and use theGet-Command -Module <snapin or module you loaded>to see if they have that particular wss* cmdlets.
If it is there then you need to add the snapin or Import the module accordingly in your script before using them.
thanks for the good idea but there was nothing, i believe the wss* cmdlets are part of the OSby DonJ at 2013-03-13 08:58:58
That’s correct, they are. The PowerShell v3 syntax is:by willbs at 2013-03-13 11:18:07
$server = New-PSSession -computername SERVERNAME
Import-Module -PSSession $server -Name MODULENAME
This assumes remoting is enabled on the server and that MODULENAME exists. You can also run Get-Module -PSSession $server -ListAvailable to see what’s installed on the remote machine.
i ran this commandby willbs at 2013-03-13 12:00:17
New-PSSession -computername 192.168.0.102 -credential $global:Credential
and got this error
i have no idea how to close shells or increase my quota
New-PSSession : [192.168.0.102] Connecting to remote server 192.168.0.102 failed with the following error message : The WS-Management service
cannot process the request. This user is allowed a maximum number of 5 concurrent shells, which has been exceeded. Close existing shells or
raise the quota for this user. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -computername 192.168.0.102 -credential $global:Credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme…RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : -2144108123,PSSessionOpenFailed
i was able to run this commandby DexterPOSH at 2013-03-19 13:37:30
$server = New-PSSession -computername 192.168.0.102 -credential $global:Credential
Get-Module -PSSession $server -ListAvailable
and got these results
ModuleType Name ExportedCommands
---------- ---- ----------------
Manifest ADRMS
Manifest AppLocker
Manifest BestPractices
Manifest BitsTransfer
Manifest PSDiagnostics
Manifest RemoteDesktopServices
Manifest ServerManager
Manifest TroubleshootingPack
Manifest WebAdministration
[quote="DonJ"]by willbs at 2013-03-23 13:14:48
You can also run Get-Module -PSSession $server -ListAvailable to see what’s installed on the remote machine.[/quote]
Cool…this parameter was added in PowerShell v3, right?
Thanks for the valuable information, Sir.
i was able to do a command like this and i imagine you can run a script this way by substituting but haven’t tried it yet:
create an admin account (for user account, remove the access level):
psexec \$global:uutName -u $global:username -p $global:password cmd /c 'echo . | "c:\program files\windows server\bin\wsspowershell.exe" -command "add-wssuser -name Devon -accesslevel administrator -firstname Devon -lastname Thegreat " '
check the admin account properties:
$Devon = psexec \$global:uutName -u $global:username -p $global:password cmd /c 'echo . | "c:\program files\windows server\bin\wsspowershell.exe" -command "get-wssuser -name Devon" '
delete the admin account:
psexec \$global:uutName -u $global:username -p $global:password cmd /c 'echo . | "c:\program files\windows server\bin\wsspowershell.exe" -command "remove-wssuser -name Devon" '