# WSMan does not exist.

**URL:** <https://forum.ansible.com/t/wsman-does-not-exist/27613>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [May 24, 2018, 9:25am UTC](https://forum.ansible.com/t/wsman-does-not-exist/27613 "2018-05-24T09:25:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MKPhil](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@MKPhil](https://forum.ansible.com/u/MKPhil)\
**Post date:** [May 24, 2018, 9:25am UTC](https://forum.ansible.com/t/wsman-does-not-exist/27613/1 "2018-05-24T09:25:40Z")

</div>

I’m trying to set up a Windows 2008R2 server using the ConfigureRemotingForAnsible.ps1 script but I get the error:

> `  
> dir : Cannot find drive. A drive with the name ‘WSMan’ does not exist.  
> At line:98 char:3
> 
> - dir 'WSMan:\localhost\Plugin' -Force:$force | ? { $\_.name -like “$filter” } | …
> - 
> 
> ```auto
> 
> ```
> 
> - CategoryInfo : ObjectNotFound: (WSMan:String) [Get-ChildItem], DriveNotFoundException
> - FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand  
> `

- PowerShell 4.0 is installed

- The script is being run as Administrator

- If I run winrm qc is says WinRM is already set up

The same script has worked on over 4000 other servers without a problem but I am stuck on this one! What am I missing?

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [May 24, 2018, 10:13am UTC](https://forum.ansible.com/t/wsman-does-not-exist/27613/2 "2018-05-24T10:13:08Z")

</div>

Are you sure you are running the same script as what is at [https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1](https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1). Line 98 is blank and we don’t run “dir 'WSMan:\localhost\Plugin'…” at all in that script. Does WSMan appear in the list after running “Get-PSDrive”?

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![MKPhil](https://avatars.discourse-cdn.com/v4/letter/m/9e8a1a/32.png) [@MKPhil](https://forum.ansible.com/u/MKPhil)\
**Post date:** [May 24, 2018, 1:09pm UTC](https://forum.ansible.com/t/wsman-does-not-exist/27613/3 "2018-05-24T13:09:49Z")

</div>

Hi Jordan,  
I am running the latest script. If I step through the script in Debug mode of the PowerShell ISE, it hits line 278:

> `If (!(Get-PSSessionConfiguration -Verbose:$false) -or (!(Get-ChildItem WSMan:\localhost\Listener)))`

It evaluates the Get-PSSessionConfiguration part OK and then the ISE opens Microsoft.WSMan.Management.psd1 [Read Only] and then the error is thrown.

WSMan isn’t in the Get-PSDrive list:

`  
PS C:\Windows\system32\> get-psdrive

Name Used (GB) Free (GB) Provider Root CurrentLocation

* * *

Alias Alias  
C 35.09 4.81 FileSystem C:\ Windows\system32  
Cert Certificate   
D 49.58 .41 FileSystem D:  
Env Environment  
Function Function  
HKCU Registry HKEY\_CURRENT\_USER  
HKLM Registry HKEY\_LOCAL\_MACHINE  
P 15.71 1.28 FileSystem P:  
Variable Variable  
`

I’m thinking WinRM is corrupt on this server - any ideas how to fix that?

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [May 24, 2018, 9:00pm UTC](https://forum.ansible.com/t/wsman-does-not-exist/27613/4 "2018-05-24T21:00:09Z")

</div>

Thanks for the info, should have realised it was in one of the cmdlets called. Sounds like WSMan is hosed if the WSMan provider isn’t listed as a PSDrive, I’ve never come across this before so not sure what the fix would be, usually I would just rebuild a new server.

Thanks

Jordan
