{"id":876,"date":"2010-08-30T08:52:15","date_gmt":"2010-08-30T12:52:15","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=876"},"modified":"2010-08-30T09:38:24","modified_gmt":"2010-08-30T13:38:24","slug":"new-psdrivehere","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/","title":{"rendered":"New-PSDriveHere"},"content":{"rendered":"<p>I spend a lot of time, as you might expect, at a PowerShell prompt. Especially when training, presenting or doing demonstrations. Very often I'm in a folder with a long path like PS C:\\users\\jeff\\Documents\\Enterprise Mgmt Webinar. That takes up a lot of screen real estate and can be distracting. What I often will do is create a PSDrive for this folder. But that takes time. What I really need is a shortcut like a function with an alias. Here's what I came up with. <!--more--><br \/>\nCreating a new PSDrive is not that difficult. You specify a drive name, which can be just about anything, a PSProvider, and a location. What I wanted was a way to take any path, from any provider, and add a PSDrive from the item's name. So if I had a path like C:\\Files\\Work, I would create a new PSDrive called Work:.<br \/>\nBut what about a folder like ...Documents\\Enterprise Mgmt Webinar? I decided that most likely I would want the last word. Although there might be occasions when I needed the first word. Finally, I wanted to be able to handle any PSProvider automatically. I ended up with a function called New-PSDriveHere.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nFunction New-PSDriveHere {<\/p>\n<p><#\n.Synopsis\nCreate a new PSDrive at the current location.\n\n.Description\nThis function will create a new PSDrive at the specified location. The default is the\ncurrent location, but you can specify any PSPath. The function will take the last word\nof the path and use it as the name of the new PSDrive. If you prefer to use the first\nword of the location, use -First.\n.Parameter Path\nThe path for the new PSDrive. The default is the current location.\n.Parameter First\nUse the first word of the current location for the new PSDrive.\n.Example\nPS C:\\users\\jeff\\Documents\\Enterprise Mgmt Webinar> new-psdrivehere<\/p>\n<p>Name           Used (GB)     Free (GB) Provider      Root                                 CurrentLocation<br \/>\n----           ---------     --------- --------      ----                                 ---------------<br \/>\nWebinar                         146.57 FileSystem    C:\\users\\jeff\\Documents\\Enter...<br \/>\n.Example<br \/>\nPS C:\\users\\jeff\\Documents\\Enterprise Mgmt Webinar> new-psdrivehere -first<\/p>\n<p>Name           Used (GB)     Free (GB) Provider      Root                                 CurrentLocation<br \/>\n----           ---------     --------- --------      ----                                 ---------------<br \/>\nEnterprise                      146.57 FileSystem    C:\\users\\jeff\\Documents\\Enter...<br \/>\n.Example<br \/>\nPS C:\\> new-psdrivehere HKLM:\\software\\microsoft<\/p>\n<p>Name           Used (GB)     Free (GB) Provider      Root                                 CurrentLocation<br \/>\n----           ---------     --------- --------      ----                                 ---------------<br \/>\nmicrosoft                              Registry      HKEY_LOCAL_MACHINE\\software\\micr...<\/p>\n<p>.Inputs<br \/>\nNone. You cannot pipe to this function.<br \/>\n.Outputs<br \/>\nSystem.Management.Automation.PSDrive<br \/>\n.Link<br \/>\nhttp:\/\/jdhitsolutions.com\/blog<\/p>\n<p>.Link<br \/>\n    Get-PSDrive<br \/>\n    New-PSDrive<\/p>\n<p>.Notes<br \/>\n NAME:      New-PSDriveHere<br \/>\n VERSION:   1.0<br \/>\n AUTHOR:    Jeffery Hicks<br \/>\n LASTEDIT:  August 27, 2010<\/p>\n<p> Learn more with a copy of Windows PowerShell 2.0: TFM (SAPIEN Press 2010)<\/p>\n<p>#><\/p>\n<p>[cmdletBinding(SupportsShouldProcess=$True)]<\/p>\n<p>Param(<br \/>\n[Parameter(Position=0)]<br \/>\n[ValidateScript({Test-Path $_})]<br \/>\n[string]$Path=\".\",<br \/>\n[switch]$First<br \/>\n)<\/p>\n<p>#get the specified location<br \/>\n$location=Get-Item -Path $path<\/p>\n<p>if ($first) {<br \/>\n    $pattern=\"^\\w+\"<br \/>\n}<br \/>\nelse {<br \/>\n    $pattern=\"\\w+$\"<br \/>\n}<\/p>\n<p>#Make sure name contains valid characters. This function<br \/>\n#should work for all but the oddest named folders.<br \/>\nif ($location.Name -match $pattern) {<br \/>\n    $name=$matches[0]<\/p>\n<p>    #verify a PSDrive doesn't already exist<br \/>\n    Write-Verbose \"Testing $($name):\"<br \/>\n    If (-not (Test-Path -path \"$($name):\")) {<br \/>\n        Write-Verbose \"Creating PSDrive for $name\"<br \/>\n        New-PSDrive -Name $name -PSProvider $location.PSProvider -Root $Path `<br \/>\n        -Description \"Created $(get-date)\" -scope Global<br \/>\n    }<br \/>\n    else {<br \/>\n        Write-Warning \"A PSDrive for $name already exists\"<br \/>\n    }<br \/>\n}<br \/>\nelse {<br \/>\n    #The location has something odd about it<br \/>\n    Write-Warning \"$path doesn't meet the criteria\"<br \/>\n }<\/p>\n<p>} #function<br \/>\n[\/cc]<br \/>\nThe function takes any location as a parameter, but defaults to the current location. The only other parameter is -First, which tells the function to use the first matching word in the location. I use a regular expression pattern to match either the first or last word of the current location, anchored accordingly.<br \/>\n[cc lang=\"Powershell\"]<br \/>\n$location=Get-Item -Path $path<\/p>\n<p>if ($first) {<br \/>\n    $pattern=\"^\\w+\"<br \/>\n}<br \/>\nelse {<br \/>\n    $pattern=\"\\w+$\"<br \/>\n}<br \/>\n[\/cc]<br \/>\nI don't want to try to map a drive if it already exists, so I use Test-Path to verify.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n Write-Verbose \"Testing $($name):\"<br \/>\n    If (-not (Test-Path -path \"$($name):\")) {<br \/>\n[\/cc]<br \/>\nIf it exists then a warning message is displayed. Otherwise the function creates the new PSDrive. The function can automatically detect the PSProvider from the location by looking at the PSProvider property.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n   New-PSDrive -Name $name -PSProvider $location.PSProvider -Root $Path `<br \/>\n        -Description \"Created $(get-date)\" -scope Global<br \/>\n[\/cc]<br \/>\nNormally, the best practice is not to create out of scope items, but in this case that is the function's purpose so I used the -Scope parameter with New-PSDrive. The cmdlet by default writes the new PSDrive to the pipeline, so that is the function's output.<br \/>\nWhat's nice is that because the function supports cmdlet binding and SupportsShouldProcess is set to $True, if I run the function using -WhatIf, this is passed to New-PSDrive without any extra coding on my part.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> new-psdrivehere $env:temp -whatif<br \/>\nWhat if: Performing operation \"New Drive\" on Target \"Name: Temp Provider: Microsoft.PowerShell.Core\\FileSystem Root: C:\\Users\\Jeff\\AppData\\Local\\Temp\".<br \/>\nPS C:\\><br \/>\n[\/cc]<br \/>\nFinally, I created an alias so I could call this function very easily with a minimum of typing.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nSet-Alias -Name npsd -Value New-PSDriveHere<br \/>\n[\/cc]<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png\" alt=\"\" title=\"npsd-70\" width=\"708\" height=\"216\" class=\"aligncenter size-full wp-image-882\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png 708w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70-300x91.png 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/a><\/p>\n<p>Download  the original version of <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/New-PSDriveHere.txt' target='_blank'>New-PSDriveHere.ps1<\/a>.<\/p>\n<p><strong>Update<\/strong><br \/>\nAs soon as I posted, I realized I was missing a useful feature. What if you didn't want to use anything in the current location name? Perhaps someone, myself included, might want a different name? So I went back and added a -Name parameter so you could specify something. I really should have made parameter sets, but it really doesn't matter. If you use -Name and -First, the latter will be ignored.<\/p>\n<p>I also updated the online link to point to this blog post.<\/p>\n<p>Download the latest version: <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/New-PSDriveHere-v1.1.txt'>New-PSDriveHere-v1.1.ps1<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I spend a lot of time, as you might expect, at a PowerShell prompt. Especially when training, presenting or doing demonstrations. Very often I&#8217;m in a folder with a long path like PS C:\\users\\jeff\\Documents\\Enterprise Mgmt Webinar. That takes up a lot of screen real estate and can be distracting. What I often will do is&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8],"tags":[224,534,150,540],"class_list":["post-876","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-function","tag-powershell","tag-psdrive","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>New-PSDriveHere &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"New-PSDriveHere &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I spend a lot of time, as you might expect, at a PowerShell prompt. Especially when training, presenting or doing demonstrations. Very often I&#039;m in a folder with a long path like PS C:usersjeffDocumentsEnterprise Mgmt Webinar. That takes up a lot of screen real estate and can be distracting. What I often will do is...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2010-08-30T12:52:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2010-08-30T13:38:24+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"New-PSDriveHere\",\"datePublished\":\"2010-08-30T12:52:15+00:00\",\"dateModified\":\"2010-08-30T13:38:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/\"},\"wordCount\":837,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/08\\\/npsd-70.png\",\"keywords\":[\"Function\",\"PowerShell\",\"PSDrive\",\"Scripting\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/\",\"name\":\"New-PSDriveHere &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/08\\\/npsd-70.png\",\"datePublished\":\"2010-08-30T12:52:15+00:00\",\"dateModified\":\"2010-08-30T13:38:24+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/#primaryimage\",\"url\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/08\\\/npsd-70.png\",\"contentUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/08\\\/npsd-70.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/876\\\/new-psdrivehere\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"New-PSDriveHere\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"New-PSDriveHere &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/","og_locale":"en_US","og_type":"article","og_title":"New-PSDriveHere &#8226; The Lonely Administrator","og_description":"I spend a lot of time, as you might expect, at a PowerShell prompt. Especially when training, presenting or doing demonstrations. Very often I'm in a folder with a long path like PS C:usersjeffDocumentsEnterprise Mgmt Webinar. That takes up a lot of screen real estate and can be distracting. What I often will do is...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/","og_site_name":"The Lonely Administrator","article_published_time":"2010-08-30T12:52:15+00:00","article_modified_time":"2010-08-30T13:38:24+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"New-PSDriveHere","datePublished":"2010-08-30T12:52:15+00:00","dateModified":"2010-08-30T13:38:24+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/"},"wordCount":837,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png","keywords":["Function","PowerShell","PSDrive","Scripting"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/","name":"New-PSDriveHere &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png","datePublished":"2010-08-30T12:52:15+00:00","dateModified":"2010-08-30T13:38:24+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/#primaryimage","url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png","contentUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/npsd-70.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/876\/new-psdrivehere\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"New-PSDriveHere"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":8585,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/8585\/i-need-a-psdrive-now\/","url_meta":{"origin":876,"position":0},"title":"I Need a PSDrive Now!","author":"Jeffery Hicks","date":"September 24, 2021","format":false,"excerpt":"I hope you've been enjoying the last few posts on working with PSDrives. To round out the set, I thought I'd remind you of a command in the PSScriptTools module that I use often, especially when teaching a live class or presenting at a conference. As you've seen, I use\u2026","rel":"","context":"In &quot;Scripting&quot;","block_context":{"text":"Scripting","link":"https:\/\/jdhitsolutions.com\/blog\/category\/scripting\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/npsd-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/npsd-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/npsd-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/npsd-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2441,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2441\/fun-with-psdrive-locations\/","url_meta":{"origin":876,"position":1},"title":"Fun with PSDrive Locations","author":"Jeffery Hicks","date":"July 10, 2012","format":false,"excerpt":"A PowerShell PSDrive is a mapping between a PowerShell provider and a resource. The majority of our work is done in a file system PSDrive that corresponds to a file system drive. Let me show you a little trick that might come in handy with a PSDrive. My \"trick\" should\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/07\/map-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":8572,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/8572\/fun-with-mapping-powershell-drives\/","url_meta":{"origin":876,"position":2},"title":"Fun with Mapping PowerShell Drives","author":"Jeffery Hicks","date":"September 22, 2021","format":false,"excerpt":"Because I spend my day working from a PowerShell prompt, I rely heavily on PSDrives to quickly access files and folders. And because I am mobile, I might be working at my desk in my home office, or I might be on the road with my trusty Thinkpad. Of course,\u2026","rel":"","context":"In &quot;Scripting&quot;","block_context":{"text":"Scripting","link":"https:\/\/jdhitsolutions.com\/blog\/category\/scripting\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/convert-csv.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/convert-csv.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/convert-csv.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/09\/convert-csv.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":8731,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8731\/fun-with-powershell-module-layout\/","url_meta":{"origin":876,"position":3},"title":"Fun with PowerShell Module Layout","author":"Jeffery Hicks","date":"December 16, 2021","format":false,"excerpt":"As I've been working on my new PowerShell project, which I've discussed over recent posts, I keep \"discovering\" fun scripting opportunities. Today I want to share some code I've come up with that makes it easier to build a PowerShell module directory structure. There are plenty of existing tools and\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/12\/get-relativepath.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/12\/get-relativepath.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/12\/get-relativepath.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/12\/get-relativepath.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":6547,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-core\/6547\/updating-powershell-core-windows-compatibility\/","url_meta":{"origin":876,"position":4},"title":"Updating PowerShell Core Windows Compatibility","author":"Jeffery Hicks","date":"February 26, 2019","format":false,"excerpt":"I thought I'd share a quick update on my experiences in living in a PowerShell Core world. One of the things that Microsoft is working on to make this easier is a way to access your Windows PowerShell modules that will work in PowerShell Core. It does this through commands\u2026","rel":"","context":"In &quot;PowerShell Core&quot;","block_context":{"text":"PowerShell Core","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-core\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/image_thumb-17.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/image_thumb-17.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/image_thumb-17.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/image_thumb-17.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7386,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7386\/psdrives-shortcuts-and-links\/","url_meta":{"origin":876,"position":5},"title":"PSDrives, Shortcuts and Links","author":"Jeffery Hicks","date":"April 15, 2020","format":false,"excerpt":"I'll be honest. I've never been much of a OneDrive user. Even though I'm a great candidate given that I use multiple systems and need access to a common set of files. But for a number of reasons I'm beginning to make more of a shift to OneDrive. Part of\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/tools-link.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/tools-link.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/tools-link.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/04\/tools-link.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/876","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=876"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/876\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=876"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=876"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}