Jump to content

Recommended Posts

Posted

Hi there

 

I'm trying to create an software updater for remote computers. I would like to create a hidden mapping rather then copy the files to the computer, i though that i could use New-PSDrive inorder to do this but maybe i'm wrong.

Thanks

 

 

 

$computer = Read-Host "Enter Computer Name"

#Start Windows Remote Service
#Get-Service -Name WinRM -ComputerName $computer | Start-service

#Run Updater on remote computer
Invoke-Command -ComputerName $computer -ScriptBlock {
New-PSDrive -Name "B" -PSProvider "FileSystem" -Root "\\Computer\Share\"
Start-Process 'B:\Update.msi'
}


#Stop Windows Remote Service
#Get-Service -Name WinRM -ComputerName $computer | Stop-service

Posted (edited)

Initial thoughts on just a quick glance at the code is you are essentially trying to multi hop within winrm and you are probably finding that you are not allowed to do right off the bat...

 

https://docs.microsoft.com/en-us/windows/win32/winrm/multi-hop-support

 

Also (I am busy and was only trying to point you in a direction here!) but if you used a bit of try{} catch{} wizardry in your code and you could then see any errors being thrown.

 

$RemoteResults = Invoke-Command - xxx - scriptblock{

 

Try{

New-psdrive xxx

}

Catch{

Return $_

}

Do the things that ain't going to throw an error..

}

 

Sorry last edit any errors will be returned to the $RemoteResults var.

Edited by HPlum78
Posted (edited)
Hi there

 

I'm trying to create an software updater for remote computers. I would like to create a hidden mapping rather then copy the files to the computer, i though that i could use New-PSDrive inorder to do this but maybe i'm wrong.

Thanks

 

 

 

$computer = Read-Host "Enter Computer Name"

#Start Windows Remote Service
#Get-Service -Name WinRM -ComputerName $computer | Start-service

#Run Updater on remote computer
Invoke-Command -ComputerName $computer -ScriptBlock {
New-PSDrive -Name "B" -PSProvider "FileSystem" -Root "\\Computer\Share\"
Start-Process 'B:\Update.msi'
}


#Stop Windows Remote Service
#Get-Service -Name WinRM -ComputerName $computer | Stop-service

 

If you are using Active Directory, can you not just hide the drive??

 

You may also be able to do the same by registry settings, I think I done that method about 10 years back.

 

https://docs.microsoft.com/en-us/troubleshoot/windows-client/group-policy/using-group-policy-objects-hide-specified-drives

 

Also beware that hiding drives is not a security fix because users can show hidden drives through windows explorer so make sure that you tie down the permissions accordingly.

Edited by Davit2005
Posted
If you are using Active Directory, can you not just hide the drive??

 

You may also be able to do the same by registry settings, I think I done that method about 10 years back.

 

https://docs.microsoft.com/en-us/troubleshoot/windows-client/group-policy/using-group-policy-objects-hide-specified-drives

 

Also beware that hiding drives is not a security fix because users can show hidden drives through windows explorer so make sure that you tie down the permissions accordingly.

.

 

It was just a case of being able to update certain software while users are logged in and having them not notice a new drive mapping appear etc.

 

Thanks

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...